diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-08-23 23:28:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-23 23:28:36 +0100 |
| commit | 41e1365fbbcfd547bd3e813afca23e7a32086b40 (patch) | |
| tree | 1a749a7d8b51e7ce3b737010088f30d2761aac0c /challenge-335/sgreen/python/test.py | |
| parent | a923e9810522db4d2ade458a4e9b670976f049ae (diff) | |
| parent | 5fded4c63588ee61d55e38c0698abc6bd8a20e4a (diff) | |
| download | perlweeklychallenge-club-41e1365fbbcfd547bd3e813afca23e7a32086b40.tar.gz perlweeklychallenge-club-41e1365fbbcfd547bd3e813afca23e7a32086b40.tar.bz2 perlweeklychallenge-club-41e1365fbbcfd547bd3e813afca23e7a32086b40.zip | |
Merge pull request #12557 from simongreen-net/master
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() |
