diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-02-25 14:54:25 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-25 14:54:25 +0000 |
| commit | f0cefc960c3aade22f4944d992a048c50ba45093 (patch) | |
| tree | 978fab9fec2cb2326e8840b985cb1d329b3e0f26 /challenge-257/sgreen/python/test.py | |
| parent | 1576956ba11d849750bf201524662abe25176ddf (diff) | |
| parent | 34cd487293ab2d6fbe7c87773b616611e5fe5543 (diff) | |
| download | perlweeklychallenge-club-f0cefc960c3aade22f4944d992a048c50ba45093.tar.gz perlweeklychallenge-club-f0cefc960c3aade22f4944d992a048c50ba45093.tar.bz2 perlweeklychallenge-club-f0cefc960c3aade22f4944d992a048c50ba45093.zip | |
Merge pull request #9639 from simongreen-net/master
Simon's solution to challenge 257
Diffstat (limited to 'challenge-257/sgreen/python/test.py')
| -rwxr-xr-x | challenge-257/sgreen/python/test.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-257/sgreen/python/test.py b/challenge-257/sgreen/python/test.py new file mode 100755 index 0000000000..2e50bc4231 --- /dev/null +++ b/challenge-257/sgreen/python/test.py @@ -0,0 +1,26 @@ +#!/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.smaller_than_current([5, 2, 1, 6]), [2, 1, 0, 3]) + self.assertEqual(ch_1.smaller_than_current([1, 2, 0, 3]), [1, 2, 0, 3]) + self.assertEqual(ch_1.smaller_than_current([0, 1]), [0, 1]) + self.assertEqual(ch_1.smaller_than_current([9, 4, 9, 2]), [2, 1, 2, 0]) + + def test_ch_2(self): + self.assertEqual(ch_2.echelon( + [[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3]]), 1) + self.assertEqual(ch_2.echelon([[1, 1, 0], [0, 1, 0], [0, 0, 0]]), 0) + self.assertEqual(ch_2.echelon( + [[0, 1, -2, 0, 1], [0, 0, 0, 1, 3], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]), 1) + self.assertEqual(ch_2.echelon( + [[1, 0, 0, 4], [0, 1, 0, 7], [0, 0, 1, -1]]), 1) + + +if __name__ == '__main__': + unittest.main() |
