44import static org .junit .jupiter .api .Assertions .assertTrue ;
55
66import java .util .stream .Stream ;
7+
78import org .junit .jupiter .params .ParameterizedTest ;
89import org .junit .jupiter .params .provider .Arguments ;
910import org .junit .jupiter .params .provider .MethodSource ;
@@ -25,22 +26,21 @@ public void testIsPowerFour(int number, boolean expected) {
2526 }
2627
2728 private static Stream <Arguments > provideNumbersForPowerFour () {
28- return Stream .of (
29- Arguments .of (1 , Boolean .TRUE ), // 4^0
30- Arguments .of (4 , Boolean .TRUE ), // 4^1
31- Arguments .of (16 , Boolean .TRUE ), // 4^2
32- Arguments .of (64 , Boolean .TRUE ), // 4^3
33- Arguments .of (256 , Boolean .TRUE ), // 4^4
34- Arguments .of (1024 , Boolean .FALSE ), // 1024 = 2^10, not 4^n
35- Arguments .of (0 , Boolean .FALSE ), // 0 is not a power of four
36- Arguments .of (-4 , Boolean .FALSE ), // Negative number
37- Arguments .of (-16 , Boolean .FALSE ), // Negative number
38- Arguments .of (2 , Boolean .FALSE ), // 2 is not a power of four
39- Arguments .of (8 , Boolean .FALSE ), // 8 = 2^3, not 4^n
40- Arguments .of (12 , Boolean .FALSE ), // 12 is not a power of four
41- Arguments .of (20 , Boolean .FALSE ), // 20 is not a power of four
42- Arguments .of (100 , Boolean .FALSE ), // 100 is not a power of four
43- Arguments .of (4096 , Boolean .TRUE ) // 4^6 = 4096
29+ return Stream .of (Arguments .of (1 , Boolean .TRUE ), // 4^0
30+ Arguments .of (4 , Boolean .TRUE ), // 4^1
31+ Arguments .of (16 , Boolean .TRUE ), // 4^2
32+ Arguments .of (64 , Boolean .TRUE ), // 4^3
33+ Arguments .of (256 , Boolean .TRUE ), // 4^4
34+ Arguments .of (1024 , Boolean .FALSE ), // 1024 = 2^10, not 4^n
35+ Arguments .of (0 , Boolean .FALSE ), // 0 is not a power of four
36+ Arguments .of (-4 , Boolean .FALSE ), // Negative number
37+ Arguments .of (-16 , Boolean .FALSE ), // Negative number
38+ Arguments .of (2 , Boolean .FALSE ), // 2 is not a power of four
39+ Arguments .of (8 , Boolean .FALSE ), // 8 = 2^3, not 4^n
40+ Arguments .of (12 , Boolean .FALSE ), // 12 is not a power of four
41+ Arguments .of (20 , Boolean .FALSE ), // 20 is not a power of four
42+ Arguments .of (100 , Boolean .FALSE ), // 100 is not a power of four
43+ Arguments .of (4096 , Boolean .TRUE ) // 4^6 = 4096
4444 );
4545 }
4646}
0 commit comments