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?