- Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.test.ts
87 lines (80 loc) · 1.63 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import*asassertsfrom"https://deno.land/std@0.125.0/testing/asserts.ts";
import*aslogfrom"https://deno.land/std@0.125.0/log/mod.ts";
import{isMatch}from"./index.ts";
log.info("49. Group Anagrams");
Deno.test({
name: `
Input:
s = "aa"
p = "a"
Output: false
Explanation: "a" does not match the entire string "aa".
`,
fn(): void{
constresult: boolean=isMatch("aa","a");
asserts.assertEquals(false,result);
},
});
Deno.test({
name: `
Input:
s = "aa"
p = "*"
Output: true
Explanation: '*' matches any sequence.
`,
fn(): void{
constresult: boolean=isMatch("aa","*");
asserts.assertEquals(true,result);
},
});
Deno.test({
name: `
Input:
s = "cb"
p = "?a"
Output: false
Explanation: '?' matches 'c', but the second letter is 'a', which does not match 'b'.
`,
fn(): void{
constresult: boolean=isMatch("cb","?a");
asserts.assertEquals(false,result);
},
});
Deno.test({
name: `
Input:
s = "adceb"
p = "*a*b"
Output: true
Explanation: The first '*' matches the empty sequence, while the second '*' matches the substring "dce".
`,
fn(): void{
constresult: boolean=isMatch("adceb","*a*b");
asserts.assertEquals(true,result);
},
});
Deno.test({
name: `
Input:
s = "acdcb"
p = "a*c?b"
Output: false
`,
fn(): void{
constresult: boolean=isMatch("acdcb","a*c?b");
asserts.assertEquals(false,result);
},
});
Deno.test({
name: `
Input:
s = "acdcb"
p = "ac*?b"
Output: true
`,
fn(): void{
constresult: boolean=isMatch("acdcb","ac*?b");
asserts.assertEquals(true,result);
},
});