-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.test.ts
53 lines (50 loc) · 946 Bytes
/
index.test.ts
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
49
50
51
52
53
import * as asserts from "https://deno.land/std@0.125.0/testing/asserts.ts";
import * as log from "https://deno.land/std@0.125.0/log/mod.ts";
import { searchMatrix } from "./index.ts";
log.info("0074 Search A 2D Marix");
Deno.test({
name: `
Input:
matrix = [
[1, 3, 5, 7],
[10, 11, 16, 20],
[23, 30, 34, 50]
]
target = 3
Output: true
`,
fn(): void {
const result: boolean = searchMatrix(
[
[1, 3, 5, 7],
[10, 11, 16, 20],
[23, 30, 34, 50],
],
3,
);
asserts.assertEquals(result, true);
},
});
Deno.test({
name: `
Input:
matrix = [
[1, 3, 5, 7],
[10, 11, 16, 20],
[23, 30, 34, 50]
]
target = 13
Output: false
`,
fn(): void {
const result: boolean = searchMatrix(
[
[1, 3, 5, 7],
[10, 11, 16, 20],
[23, 30, 34, 50],
],
13,
);
asserts.assertEquals(result, false);
},
});