summaryrefslogtreecommitdiff
path: root/19/test.py
blob: f2fab39bfc9296f7d34ca2862e4f7c22302c69e8 (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
#!/usr/bin/python

import unittest

import main



class Examples(unittest.TestCase):
    def test_example1(self):
        lines = [
            "e => H",
            "e => O",
            "H => HO",
            "H => OH",
            "O => HH",
            "",
            "HOH"
        ]
        self.assertEqual(main.solve_part1(lines), 4)
        self.assertEqual(main.solve_part2(lines), 3)

    def test_example2(self):
        lines = [
            "e => H",
            "e => O",
            "H => HO",
            "H => OH",
            "O => HH",
            "",
            "HOHOHO"
        ]
        self.assertEqual(main.solve_part1(lines), 7)
        self.assertEqual(main.solve_part2(lines), 6)



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