Browse Source

Test: Write positive numbers test for factorial calculation

remotes/origin/test/client/add-test-cases
Alena Bandarovich 11 months ago
parent
commit
cec39970df
  1. 13
      src/test/java/CalculationsTest.java

13
src/test/java/CalculationsTest.java

@ -18,6 +18,19 @@ public class CalculationsTest {
// Test with a large number // Test with a large number
assertEquals(1000000, calc.calculateSquare(1000)); assertEquals(1000000, calc.calculateSquare(1000));
}
@Test
public void testCalculateFactorial() {
Calculations fact = new Calculations();
// Test with positive numbers
assertEquals(1, fact.calculateFactorial(0));
assertEquals(1, fact.calculateFactorial(1));
assertEquals(2, fact.calculateFactorial(2));
assertEquals(6, fact.calculateFactorial(3));
assertEquals(24, fact.calculateFactorial(4));
assertEquals(120, fact.calculateFactorial(5));
} }
} }
Loading…
Cancel
Save