-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatching_test.py
79 lines (53 loc) · 1.86 KB
/
matching_test.py
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
# TEST FILE FOR MATCHER
# DO NOT MODIFY
from matching import matcher
def test_matcher_pass_solo1():
assert matcher("[ ]") == True
def test_matcher_pass_solo2():
assert matcher("{ }") == True
def test_matcher_pass_none():
assert matcher("hello") == True
def test_matcher_pass_arith():
assert matcher("(45 + 36) - 5") == True
def test_matcher_pass_mix2():
assert matcher("[()]") == True
def test_matcher_pass_mix3():
assert matcher("{[()]}") == True
def test_matcher_pass_mix5():
assert matcher("{ () [ [] ( {} ) ] }") == True
def test_matcher_pass_mix_lots():
assert matcher("{[()]} [ ] ( ) ([{}]) { () [ [] ( {} ) ] } ( {[()] [] } {} )") == True
def test_matcher_pass_mix():
assert matcher("map{key[a(4)]}{b([v])}") == True
def test_matcher_pass_paren():
assert matcher("map(ke(a(4)))(b((v)))") == True
def test_matcher_fail_paren():
assert matcher("( ( a )") == False
def test_matcher_fail_mix():
assert matcher("({)}") == False
def test_matcher_fail_mix2():
assert matcher("[(])") == False
def test_matcher_fail_mix3():
assert matcher("{[(})]") == False
def test_matcher_fail_mix4():
assert matcher("({)") == False
def test_matcher_fail_mix5():
assert matcher("[(]") == False
def test_matcher_fail_mix6():
assert matcher("{[(})") == False
def test_matcher_fail_mix7():
assert matcher("{[(])}") == False
def test_matcher_fail_mix8():
assert matcher("{[()}()]") == False
def test_matcher_fail_back_paren():
assert matcher("))((") == False
def test_matcher_fail_uneven_paren():
assert matcher("(a)b)") == False
def test_matcher_fail_back_mix():
assert matcher("]){(") == False
def test_matcher_fail_back_mix2():
assert matcher("])[(") == False
def test_matcher_fail_uneven_mix():
assert matcher("(a)b}") == False
def test_matcher_fail_uneven_mix2():
assert matcher("a[b]{") == False