-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverification.php
More file actions
48 lines (46 loc) · 985 Bytes
/
verification.php
File metadata and controls
48 lines (46 loc) · 985 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$tests = [
'square' => [
'matrix' => [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
],
'transposed' => [
[1, 4, 7],
[2, 5, 8],
[3, 6, 9]
]
],
'wide' => [
'matrix' => [
[1, 2, 3, 4],
[5, 6, 7, 8]
],
'transposed' => [
[1, 5],
[2, 6],
[3, 7],
[4, 8]
]
],
'tall' => [
'matrix' => [
[1, 2],
[3, 4],
[5, 6],
[7, 8]
],
'transposed' => [
[1, 3, 5, 7],
[2, 4, 6, 8]
]
]
];
function testTransposer($transpose) {
global $tests;
foreach ($tests as $matrixType => $test) {
$result = $transpose($test['matrix']) == $test['transposed'] ? "Pass" : "Fail";
printf("Testing transpose function on a %s matrix:\t%s\n", $matrixType, $result);
}
}