Skip to content

Commit dbe2a42

Browse files
committed
style: use assertFalse and assertTrue
1 parent d3bb691 commit dbe2a42

File tree

5 files changed

+37
-30
lines changed

5 files changed

+37
-30
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package com.thealgorithms.bitmanipulation;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
45

56
import org.junit.jupiter.api.Test;
67

78
class IsEvenTest {
89
@Test
910
void testIsEven() {
10-
assertEquals(true, IsEven.isEven(2));
11-
assertEquals(true, IsEven.isEven(-12));
12-
assertEquals(false, IsEven.isEven(21));
11+
assertTrue(IsEven.isEven(0));
12+
assertTrue(IsEven.isEven(2));
13+
assertTrue(IsEven.isEven(-12));
14+
assertFalse(IsEven.isEven(21));
15+
assertFalse(IsEven.isEven(-1));
1316
}
1417
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package com.thealgorithms.dynamicprogramming;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
45

56
import org.junit.jupiter.api.Test;
67

78
class SumOfSubsetTest {
89

910
@Test
1011
void basicCheck() {
11-
assertEquals(false, SumOfSubset.subsetSum(new int[] {1, 2, 7, 10, 9}, 4, 14));
12-
assertEquals(false, SumOfSubset.subsetSum(new int[] {2, 15, 1, 6, 7}, 4, 4));
13-
assertEquals(true, SumOfSubset.subsetSum(new int[] {7, 3, 2, 5, 8}, 4, 14));
14-
assertEquals(true, SumOfSubset.subsetSum(new int[] {4, 3, 2, 1}, 3, 5));
15-
assertEquals(true, SumOfSubset.subsetSum(new int[] {1, 7, 2, 9, 10}, 4, 13));
12+
assertFalse(SumOfSubset.subsetSum(new int[] {1, 2, 7, 10, 9}, 4, 14));
13+
assertFalse(SumOfSubset.subsetSum(new int[] {2, 15, 1, 6, 7}, 4, 4));
14+
assertTrue(SumOfSubset.subsetSum(new int[] {7, 3, 2, 5, 8}, 4, 14));
15+
assertTrue(SumOfSubset.subsetSum(new int[] {4, 3, 2, 1}, 3, 5));
16+
assertTrue(SumOfSubset.subsetSum(new int[] {1, 7, 2, 9, 10}, 4, 13));
1617
}
1718
}
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package com.thealgorithms.maths;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
45

56
import org.junit.jupiter.api.Test;
67

78
public class PythagoreanTripleTest {
89

910
@Test
1011
public void Testpythagoreantriple() {
11-
assertEquals(true, PythagoreanTriple.isPythagTriple(3, 4, 5));
12-
assertEquals(true, PythagoreanTriple.isPythagTriple(6, 8, 10));
13-
assertEquals(true, PythagoreanTriple.isPythagTriple(9, 12, 15));
14-
assertEquals(true, PythagoreanTriple.isPythagTriple(12, 16, 20));
15-
assertEquals(true, PythagoreanTriple.isPythagTriple(15, 20, 25));
16-
assertEquals(true, PythagoreanTriple.isPythagTriple(18, 24, 30));
17-
assertEquals(false, PythagoreanTriple.isPythagTriple(5, 20, 30));
18-
assertEquals(false, PythagoreanTriple.isPythagTriple(6, 8, 100));
19-
assertEquals(false, PythagoreanTriple.isPythagTriple(-2, -2, 2));
12+
assertTrue(PythagoreanTriple.isPythagTriple(3, 4, 5));
13+
assertTrue(PythagoreanTriple.isPythagTriple(6, 8, 10));
14+
assertTrue(PythagoreanTriple.isPythagTriple(9, 12, 15));
15+
assertTrue(PythagoreanTriple.isPythagTriple(12, 16, 20));
16+
assertTrue(PythagoreanTriple.isPythagTriple(15, 20, 25));
17+
assertTrue(PythagoreanTriple.isPythagTriple(18, 24, 30));
18+
assertFalse(PythagoreanTriple.isPythagTriple(5, 20, 30));
19+
assertFalse(PythagoreanTriple.isPythagTriple(6, 8, 100));
20+
assertFalse(PythagoreanTriple.isPythagTriple(-2, -2, 2));
2021
}
2122
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.thealgorithms.others;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
45

56
import org.junit.jupiter.api.Test;
67

@@ -10,34 +11,34 @@ public class TwoPointersTest {
1011
void twoPointersFirstTestCase() {
1112
int[] arr = {2, 6, 9, 22, 121};
1213
int key = 28;
13-
assertEquals(true, TwoPointers.isPairedSum(arr, key));
14+
assertTrue(TwoPointers.isPairedSum(arr, key));
1415
}
1516

1617
@Test
1718
void twoPointersSecondTestCase() {
1819
int[] arr = {-1, -12, 12, 0, 8};
1920
int key = 0;
20-
assertEquals(true, TwoPointers.isPairedSum(arr, key));
21+
assertTrue(TwoPointers.isPairedSum(arr, key));
2122
}
2223

2324
@Test
2425
void twoPointersThirdTestCase() {
2526
int[] arr = {12, 35, 12, 152, 0};
2627
int key = 13;
27-
assertEquals(false, TwoPointers.isPairedSum(arr, key));
28+
assertFalse(TwoPointers.isPairedSum(arr, key));
2829
}
2930

3031
@Test
3132
void twoPointersFourthTestCase() {
3233
int[] arr = {-2, 5, -1, 52, 31};
3334
int key = -3;
34-
assertEquals(true, TwoPointers.isPairedSum(arr, key));
35+
assertTrue(TwoPointers.isPairedSum(arr, key));
3536
}
3637

3738
@Test
3839
void twoPointersFiftiethTestCase() {
3940
int[] arr = {25, 1, 0, 61, 21};
4041
int key = 12;
41-
assertEquals(false, TwoPointers.isPairedSum(arr, key));
42+
assertFalse(TwoPointers.isPairedSum(arr, key));
4243
}
4344
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
package com.thealgorithms.strings;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
45

56
import org.junit.jupiter.api.Test;
67

78
public class ValidParenthesesTest {
89

910
@Test
1011
void testOne() {
11-
assertEquals(true, ValidParentheses.isValid("()"));
12+
assertTrue(ValidParentheses.isValid("()"));
1213
}
1314

1415
@Test
1516
void testTwo() {
16-
assertEquals(true, ValidParentheses.isValid("()[]{}"));
17+
assertTrue(ValidParentheses.isValid("()[]{}"));
1718
}
1819

1920
@Test
2021
void testThree() {
21-
assertEquals(false, ValidParentheses.isValid("(]"));
22+
assertFalse(ValidParentheses.isValid("(]"));
2223
}
2324
}

0 commit comments

Comments
 (0)