@@ -23,99 +23,102 @@ public static function setUpBeforeClass(): void
2323 * Don't use gmp or any other similar libraries.
2424 * Try to make the solution for virtually any board size.
2525 */
26-
26+
2727 /**
2828 * uuid: 9fbde8de-36b2-49de-baf2-cd42d6f28405
2929 */
30- #[TestDox('1 ' )]
31- public function testInput1 (): void
30+ #[TestDox('grains on square 1 ' )]
31+ public function testGrainsOnSquare1 (): void
3232 {
33- $ this ->assertSame (' 1 ' , square (1 ));
33+ $ this ->assertSame (1 , square (1 ));
3434 }
3535
3636 /**
3737 * uuid: ee1f30c2-01d8-4298-b25d-c677331b5e6d
3838 */
39- #[TestDox('2 ' )]
40- public function testInput2 (): void
39+ #[TestDox('grains on square 2 ' )]
40+ public function testGrainsOnSquare2 (): void
4141 {
42- $ this ->assertSame (' 2 ' , square (2 ));
42+ $ this ->assertSame (2 , square (2 ));
4343 }
4444
4545 /**
4646 * uuid: 10f45584-2fc3-4875-8ec6-666065d1163b
4747 */
48- #[TestDox('3 ' )]
49- public function testInput3 (): void
48+ #[TestDox('grains on square 3 ' )]
49+ public function testGrainsOnSquare3 (): void
5050 {
51- $ this ->assertSame (' 4 ' , square (3 ));
51+ $ this ->assertSame (4 , square (3 ));
5252 }
5353
5454 /**
5555 * uuid: a7cbe01b-36f4-4601-b053-c5f6ae055170
5656 */
57- #[TestDox('4 ' )]
58- public function testInput4 (): void
57+ #[TestDox('grains on square 4 ' )]
58+ public function testGrainsOnSquare4 (): void
5959 {
60- $ this ->assertSame (' 8 ' , square (4 ));
60+ $ this ->assertSame (8 , square (4 ));
6161 }
6262
6363 /**
6464 * uuid: c50acc89-8535-44e4-918f-b848ad2817d4
6565 */
66- #[TestDox('16 ' )]
67- public function testInput16 (): void
66+ #[TestDox('grains on square 16 ' )]
67+ public function testGrainsOnSquare16 (): void
6868 {
69- $ this ->assertSame (' 32768 ' , square (16 ));
69+ $ this ->assertSame (32768 , square (16 ));
7070 }
7171
7272 /**
7373 * uuid: acd81b46-c2ad-4951-b848-80d15ed5a04f
7474 */
75- #[TestDox('32 ' )]
76- public function testInput32 (): void
75+ #[TestDox('grains on square 32 ' )]
76+ public function testGrainsOnSquare32 (): void
7777 {
78- $ this ->assertSame (' 2147483648 ' , square (32 ));
78+ $ this ->assertSame (2147483648 , square (32 ));
7979 }
8080
8181 /**
8282 * uuid: c73b470a-5efb-4d53-9ac6-c5f6487f227b
8383 */
84- #[TestDox('64 ' )]
85- public function testInput64 (): void
84+ #[TestDox('grains on square 64 ' )]
85+ public function testGrainsOnSquare64 (): void
8686 {
87- $ this ->assertSame (' 9223372036854775808 ' , square (64 ));
87+ $ this ->assertSame (9223372036854775808 , square (64 ));
8888 }
8989
9090 /**
9191 * uuid: 1d47d832-3e85-4974-9466-5bd35af484e3
9292 */
93- #[TestDox('square 0 raises an exception ' )]
94- public function testRejectsZero (): void
93+ #[TestDox('square 0 is invalid ' )]
94+ public function testSquare0IsInvalid (): void
9595 {
9696 $ this ->expectException (InvalidArgumentException::class);
97+ $ this ->expectExceptionMessage ('square must be between 1 and 64 ' );
9798
9899 square (0 );
99100 }
100101
101102 /**
102103 * uuid: 61974483-eeb2-465e-be54-ca5dde366453
103104 */
104- #[TestDox('negative square raises an exception ' )]
105+ #[TestDox('negative square is invalid ' )]
105106 public function testRejectsNegative (): void
106107 {
107108 $ this ->expectException (InvalidArgumentException::class);
109+ $ this ->expectExceptionMessage ('square must be between 1 and 64 ' );
108110
109111 square (-1 );
110112 }
111113
112114 /**
113115 * uuid: a95e4374-f32c-45a7-a10d-ffec475c012f
114116 */
115- #[TestDox('square greater than 64 raises an exception ' )]
117+ #[TestDox('square greater than 64 is invalid ' )]
116118 public function testRejectsGreaterThan64 (): void
117119 {
118120 $ this ->expectException (InvalidArgumentException::class);
121+ $ this ->expectExceptionMessage ('square must be between 1 and 64 ' );
119122
120123 square (65 );
121124 }
@@ -126,6 +129,6 @@ public function testRejectsGreaterThan64(): void
126129 #[TestDox('returns the total number of grains on the board ' )]
127130 public function testTotal (): void
128131 {
129- $ this ->assertSame (' 18446744073709551615 ' , total ());
132+ $ this ->assertSame (18446744073709551615 , total ());
130133 }
131134}
0 commit comments