summaryrefslogtreecommitdiff
path: root/tests/check_bracketTest.py
blob: 40f97d072d6d0ac5bb971f71cfc7a116ff3b24f0 (plain)
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
import unittest

from sources.check_bracket import check_bracket


class MyTestCase(unittest.TestCase):

    def test1(self):
        exp = "[]"
        self.assertEqual("Success", check_bracket(exp))

    def test2(self):
        exp = "{}[]"
        self.assertEqual("Success", check_bracket(exp))

    def test3(self):
        exp = "[()]"
        self.assertEqual("Success", check_bracket(exp))

    def test4(self):
        exp = "(())"
        self.assertEqual("Success", check_bracket(exp))

    def test5(self):
        exp = "{[]}()"
        self.assertEqual("Success", check_bracket(exp))

    def test6(self):
        exp = "{"
        self.assertEqual(1, check_bracket(exp))

    def test7(self):
        exp = "{[}"
        self.assertEqual(3, check_bracket(exp))

    def test8(self):
        exp = "foo(bar)"
        self.assertEqual("Success", check_bracket(exp))

    def test9(self):
        exp = "foo(bar[i);"
        self.assertEqual(10, check_bracket(exp))

    def test10(self):
        exp = "[](()"
        self.assertEqual(3, check_bracket(exp))

    def test11(self):
        exp = "{[}haha"
        self.assertEqual(3, check_bracket(exp))

    def test12(self):
        exp = "haha{[}"
        self.assertEqual(7, check_bracket(exp))


if __name__ == '__main__':
    unittest.main()