Browse Source

Test: check prime for non-prime numbers

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

15
src/test/java/CalculationsTest.java

@ -1,7 +1,7 @@
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
public class CalculationsTest {
@ -46,9 +46,16 @@ public class CalculationsTest {
@Test
public void testIsPrime() {
assertTrue(Calculations.isPrime(2)); // Prime number
assertTrue(Calculations.isPrime(3)); // Prime number
assertTrue(Calculations.isPrime(5)); // Prime number
// Prime
assertTrue(Calculations.isPrime(2));
assertTrue(Calculations.isPrime(3));
assertTrue(Calculations.isPrime(5));
// Non-Prime
assertFalse(Calculations.isPrime(22));
assertFalse(Calculations.isPrime(25));
assertFalse(Calculations.isPrime(27));
assertFalse(Calculations.isPrime(30));
}
}
Loading…
Cancel
Save