diff options
| author | Simon Green <mail@simon.green> | 2025-08-23 15:27:04 +1000 |
|---|---|---|
| committer | Simon Green <mail@simon.green> | 2025-08-23 15:27:04 +1000 |
| commit | 5fded4c63588ee61d55e38c0698abc6bd8a20e4a (patch) | |
| tree | 3ef28d4fb8ebc04cdcd56f18c8ee41b54de6bc58 /challenge-335/sgreen/python/test.py | |
| parent | 4f766edf1327ad3628c824c3c00f1c1f10c50b38 (diff) | |
| download | perlweeklychallenge-club-5fded4c63588ee61d55e38c0698abc6bd8a20e4a.tar.gz perlweeklychallenge-club-5fded4c63588ee61d55e38c0698abc6bd8a20e4a.tar.bz2 perlweeklychallenge-club-5fded4c63588ee61d55e38c0698abc6bd8a20e4a.zip | |
sgreen solutions to challenge 335
Diffstat (limited to 'challenge-335/sgreen/python/test.py')
| -rwxr-xr-x | challenge-335/sgreen/python/test.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-335/sgreen/python/test.py b/challenge-335/sgreen/python/test.py new file mode 100755 index 0000000000..2f4a95cbef --- /dev/null +++ b/challenge-335/sgreen/python/test.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import unittest +ch_1 = __import__('ch-1') +ch_2 = __import__('ch-2') + + +class TestClass(unittest.TestCase): + def test_ch_1(self): + self.assertEqual(ch_1.common_characters(["bella", "label", "roller"]), ["e", "l", "l"]) + self.assertEqual(ch_1.common_characters(["cool", "lock", "cook"]), ["c", "o"]) + self.assertEqual(ch_1.common_characters(["hello", "world", "pole"]), ["l", "o"]) + self.assertEqual(ch_1.common_characters(["abc", "def", "ghi"]), []) + self.assertEqual(ch_1.common_characters(["aab", "aac", "aaa"]), ["a", "a"]) + + def test_ch_2(self): + moves_1 = [[0,0],[2,0],[1,1],[2,1],[2,2]] + moves_2 = [[0,0],[1,1],[0,1],[0,2],[1,0],[2,0]] + moves_3 = [[0,0],[1,1],[2,0],[1,0],[1,2],[2,1],[0,1],[0,2],[2,2]] + moves_4 = [[0,0],[1,1]] + moves_5 = [[1,1],[0,0],[2,2],[0,1],[1,0],[0,2]] + self.assertEqual(ch_2.find_winner(moves_1), "A") + self.assertEqual(ch_2.find_winner(moves_2), "B") + self.assertEqual(ch_2.find_winner(moves_3), "Draw") + self.assertEqual(ch_2.find_winner(moves_4), "Pending") + self.assertEqual(ch_2.find_winner(moves_5), "B") + + +if __name__ == '__main__': + unittest.main() |
