forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerOfFourTest.java
More file actions
32 lines (27 loc) · 990 Bytes
/
PowerOfFourTest.java
File metadata and controls
32 lines (27 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.thealgorithms.bitmanipulation;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link PowerOfFour}.
*/
public final class PowerOfFourTest {
@Test
void testPowerOfFourTrueCases() {
Assertions.assertTrue(PowerOfFour.isPowerOfFour(1));
Assertions.assertTrue(PowerOfFour.isPowerOfFour(4));
Assertions.assertTrue(PowerOfFour.isPowerOfFour(16));
Assertions.assertTrue(PowerOfFour.isPowerOfFour(64));
}
@Test
void testPowerOfFourFalseCases() {
Assertions.assertFalse(PowerOfFour.isPowerOfFour(0));
Assertions.assertFalse(PowerOfFour.isPowerOfFour(2));
Assertions.assertFalse(PowerOfFour.isPowerOfFour(8));
Assertions.assertFalse(PowerOfFour.isPowerOfFour(12));
}
@Test
void testNegativeNumbers() {
Assertions.assertFalse(PowerOfFour.isPowerOfFour(-4));
Assertions.assertFalse(PowerOfFour.isPowerOfFour(-16));
}
}