diff options
Diffstat (limited to 'challenge-288/sgreen/python/test.py')
| -rwxr-xr-x | challenge-288/sgreen/python/test.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/challenge-288/sgreen/python/test.py b/challenge-288/sgreen/python/test.py new file mode 100755 index 0000000000..51af278fbe --- /dev/null +++ b/challenge-288/sgreen/python/test.py @@ -0,0 +1,43 @@ +#!/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.closest_palindrome(123), 121) + self.assertEqual(ch_1.closest_palindrome(2), 1) + self.assertEqual(ch_1.closest_palindrome(1400), 1441) + self.assertEqual(ch_1.closest_palindrome(1001), 999) + + def test_ch_2(self): + matrix_1 = [ + ['x', 'x', 'x', 'x', 'o'], + ['x', 'o', 'o', 'o', 'o'], + ['x', 'o', 'o', 'o', 'o'], + ['x', 'x', 'x', 'o', 'o'], + ] + + matrix_2 = [ + ['x', 'x', 'x', 'x', 'x'], + ['x', 'o', 'o', 'o', 'o'], + ['x', 'x', 'x', 'x', 'o'], + ['x', 'o', 'o', 'o', 'o'], + ] + + matrix_3 = [ + ['x', 'x', 'x', 'o', 'o'], + ['o', 'o', 'o', 'x', 'x'], + ['o', 'x', 'x', 'o', 'o'], + ['o', 'o', 'o', 'x', 'x'], + ] + + self.assertEqual(ch_2.contiguous_block(matrix_1), 11) + self.assertEqual(ch_2.contiguous_block(matrix_2), 11) + self.assertEqual(ch_2.contiguous_block(matrix_3), 7) + + +if __name__ == '__main__': + unittest.main() |
