# providing a set of values to test (x-y)

I've been tasked with providing a comprehensive test for some code that calculates x-y.

You can assume that the code is not simply (x-y)

My idea is that a good set of values would be: 3 and 7

I think this because they are prime. Can anyone give me their opinion on this.

Many thanks.

-
My opinion is that this is a coding problem, and would fit better on the coding website than here on the math website. –  Gerry Myerson Nov 4 '12 at 11:54
@Fendorio, it is impossible to completely test it because there are infinitely many numbers and you can only test finitely many! To check that - is correct you need to proof by induction. –  sperners lemma Nov 4 '12 at 11:56
add comment

## 1 Answer

This is really a coding question, but I would recommend having a set of test data which ensures that all possible sorts of result are tested, such as:

• $x=7$ and $y=7$ (test it gives the correct answer for equal inputs)
• $x=3$ and $y=7$ (test it gives the correct answer for $x<y$)
• $x=7$ and $y=3$ (test it gives the correct answer for $x>y$)

It is probably also worth testing that you get the correct answer if $x$ or $y$ or both take the maximum value (or minimum value, i.e. most negative) allowed in your implementation language.

-
Ok that's brilliant. Thank you for your input! When i'm able to vote answers up i will be sure to vote yours. Thanks again. –  Fendorio Nov 4 '12 at 15:10
add comment