# Finding the correct partitions for testing digits

I have a function that returns: if x=2y is true., x and y are both digits. A sample code is below:

``````public class MyClass {

static boolean xDoubleY(int x, int y) {
boolean result;
int temp;

temp = y * 2;
if (x == temp) {
result = true;
System.out.println("X is twice Y");
} else {
result = false;
System.out.println("X is not twice Y");
}
return result;
}

public static void main(String[] args) {
boolean result1,result2;
int x1=4;
int y1=2;
int x2=5;

result1 = xDoubleY(x1, y1);
result2 = xDoubleY(x2, y1);
}
}
``````

On one hand, I can think of values for each x and y which are less than, equal or more than zero.

On the other hand, I can think of relation of x and y, and which values would make the expression invalid/valid.

What would be the correct way of finding the correct partitions for this case?

Also, how can boundary value analysis be performed since we have two variables?

• Can you show the actual code – Amias Jan 28 '19 at 23:40
• @Amias, thanks, actually since this is Black Box testing, the code should matter. – Fabiana Jan 29 '19 at 5:25
• @Fabiana, the code always matters: Depending on the implementation, you will have overflows errors with different values. – João Farias Jan 29 '19 at 6:13
• @JoãoFarias I added a sample Java code – Fabiana Jan 29 '19 at 9:31

• It seems to me that the only way to raise an exception is to create an overflow on `y*2`. Then, you can use y with { (Max int / 2) - 1, (Max int / 2), ( Max int / 2 ) + 1 }.