0

I have a method isPerfect(x) (with 4<=x<=10000) below, how to write test cases based on Equivalence Class, Boundary Value, and Basis Path Testing:

public boolean checkPerfectNumber(int x) {
        if(x >= 4 && x <= 10000) {
            int sum = 0;            
            for(int i = 1; i < x; i++) {
                if(x % i == 0) {
                    sum += i;
                }
            }           
            if(sum == x) return true;
        }
        return false;
    }
ranmeo123
  • 1
  • 1
  • Does this answer your question? [Equivalence Class Testing vs. Boundary Value Testing](https://stackoverflow.com/questions/1909280/equivalence-class-testing-vs-boundary-value-testing) – Krishna Majgaonkar Jan 16 '22 at 09:19
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 26 '22 at 10:00

0 Answers0