11<?php
22
3- /*
4- * By adding type hints and enabling strict type checking, code can become
5- * easier to read, self-documenting and reduce the number of potential bugs.
6- * By default, type declarations are non-strict, which means they will attempt
7- * to change the original type to match the type specified by the
8- * type-declaration.
9- *
10- * In other words, if you pass a string to a function requiring a float,
11- * it will attempt to convert the string value to a float.
12- *
13- * To enable strict mode, a single declare directive must be placed at the top
14- * of the file.
15- * This means that the strictness of typing is configured on a per-file basis.
16- * This directive not only affects the type declarations of parameters, but also
17- * a function's return type.
18- *
19- * For more info review the Concept on strict type checking in the PHP track
20- * <link>.
21- *
22- * To disable strict typing, comment out the directive below.
23- */
24-
253declare (strict_types=1 );
264
275use PHPUnit \Framework \TestCase ;
6+ use PHPUnit \Framework \Attributes \TestDox ;
287
298class TransposeTest extends TestCase
309{
@@ -33,13 +12,21 @@ public static function setUpBeforeClass(): void
3312 require_once 'Transpose.php ' ;
3413 }
3514
15+ /**
16+ * uuid: 404b7262-c050-4df0-a2a2-0cb06cd6a821
17+ */
18+ #[TestDox('Empty string ' )]
3619 public function testEmptyString (): void
3720 {
3821 $ input = ["" ];
3922 $ expected = ["" ];
4023 $ this ->assertEquals ($ expected , transpose ($ input ));
4124 }
4225
26+ /**
27+ * uuid: a89ce8a3-c940-4703-a688-3ea39412fbcb
28+ */
29+ #[TestDox('Two characters in a row ' )]
4330 public function testTwoCharactersInARow (): void
4431 {
4532 $ input = [
@@ -52,6 +39,10 @@ public function testTwoCharactersInARow(): void
5239 $ this ->assertEquals ($ expected , transpose ($ input ));
5340 }
5441
42+ /**
43+ * uuid: 855bb6ae-4180-457c-abd0-ce489803ce98
44+ */
45+ #[TestDox('Two characters in a column ' )]
5546 public function testTwoCharactersInAColumn (): void
5647 {
5748 $ input = [
@@ -64,6 +55,10 @@ public function testTwoCharactersInAColumn(): void
6455 $ this ->assertEquals ($ expected , transpose ($ input ));
6556 }
6657
58+ /**
59+ * uuid: 5ceda1c0-f940-441c-a244-0ced197769c8
60+ */
61+ #[TestDox('Simple ' )]
6762 public function testSimple (): void
6863 {
6964 $ input = [
@@ -78,6 +73,10 @@ public function testSimple(): void
7873 $ this ->assertEquals ($ expected , transpose ($ input ));
7974 }
8075
76+ /**
77+ * uuid: a54675dd-ae7d-4a58-a9c4-0c20e99a7c1f
78+ */
79+ #[TestDox('Single line ' )]
8180 public function testSingleLine (): void
8281 {
8382 $ input = [
@@ -100,6 +99,10 @@ public function testSingleLine(): void
10099 $ this ->assertEquals ($ expected , transpose ($ input ));
101100 }
102101
102+ /**
103+ * uuid: 0dc2ec0b-549d-4047-aeeb-8029fec8d5c5
104+ */
105+ #[TestDox('First line longer than second line ' )]
103106 public function testFirstLineLongerThanSecondLine (): void
104107 {
105108 $ input = [
@@ -127,6 +130,10 @@ public function testFirstLineLongerThanSecondLine(): void
127130 $ this ->assertEquals ($ expected , transpose ($ input ));
128131 }
129132
133+ /**
134+ * uuid: 984e2ec3-b3d3-4b53-8bd6-96f5ef404102
135+ */
136+ #[TestDox('Second line longer than first line ' )]
130137 public function testSecondLineLongerThanFirstLine (): void
131138 {
132139 $ input = [
@@ -154,6 +161,44 @@ public function testSecondLineLongerThanFirstLine(): void
154161 $ this ->assertEquals ($ expected , transpose ($ input ));
155162 }
156163
164+ /**
165+ * uuid: eccd3784-45f0-4a3f-865a-360cb323d314
166+ */
167+ #[TestDox('Mixed line length ' )]
168+ public function testMixedLineLength (): void
169+ {
170+ $ input = [
171+ "The longest line. " ,
172+ "A long line. " ,
173+ "A longer line. " ,
174+ "A line. " ,
175+ ];
176+ $ expected = [
177+ "TAAA " ,
178+ "h " ,
179+ "elll " ,
180+ " ooi " ,
181+ "lnnn " ,
182+ "ogge " ,
183+ "n e. " ,
184+ "glr " ,
185+ "ei " ,
186+ "snl " ,
187+ "tei " ,
188+ " .n " ,
189+ "l e " ,
190+ "i . " ,
191+ "n " ,
192+ "e " ,
193+ ". " ,
194+ ];
195+ $ this ->assertEquals ($ expected , transpose ($ input ));
196+ }
197+
198+ /**
199+ * uuid: 85b96b3f-d00c-4f80-8ca2-c8a5c9216c2d
200+ */
201+ #[TestDox('Square ' )]
157202 public function testSquare (): void
158203 {
159204 $ input = [
@@ -173,6 +218,10 @@ public function testSquare(): void
173218 $ this ->assertEquals ($ expected , transpose ($ input ));
174219 }
175220
221+ /**
222+ * uuid: b9257625-7a53-4748-8863-e08e9d27071d
223+ */
224+ #[TestDox('Rectangle ' )]
176225 public function testRectangle (): void
177226 {
178227 $ input = [
@@ -194,6 +243,10 @@ public function testRectangle(): void
194243 $ this ->assertEquals ($ expected , transpose ($ input ));
195244 }
196245
246+ /**
247+ * uuid: b80badc9-057e-4543-bd07-ce1296a1ea2c
248+ */
249+ #[TestDox('Triangle ' )]
197250 public function testTriangle (): void
198251 {
199252 $ input = [
@@ -215,6 +268,32 @@ public function testTriangle(): void
215268 $ this ->assertEquals ($ expected , transpose ($ input ));
216269 }
217270
271+ /**
272+ * uuid: 76acfd50-5596-4d05-89f1-5116328a7dd9
273+ */
274+ #[TestDox('Jagged triangle ' )]
275+ public function testJaggedTriangle (): void
276+ {
277+ $ input = [
278+ "11 " ,
279+ "2 " ,
280+ "3333 " ,
281+ "444 " ,
282+ "555555 " ,
283+ "66666 " ,
284+ ];
285+ $ expected = [
286+ "123456 " ,
287+ "1 3456 " ,
288+ " 3456 " ,
289+ " 3 56 " ,
290+ " 56 " ,
291+ " 5 " ,
292+ ];
293+ $ this ->assertEquals ($ expected , transpose ($ input ));
294+ }
295+
296+ #[TestDox('Many lines ' )]
218297 public function testManyLines (): void
219298 {
220299 $ input = [
0 commit comments