aboutsummaryrefslogtreecommitdiff
path: root/challenge-337/sgreen/python/test.py
diff options
context:
space:
mode:
authorrir <rirans@comcast.net>2025-09-12 13:09:41 -0400
committerGitHub <noreply@github.com>2025-09-12 13:09:41 -0400
commitf87e72e5d596f0411c4f0efb7ca1ec219311167b (patch)
treefebcff8b26e7850d618294dab6501fe039fd0a81 /challenge-337/sgreen/python/test.py
parent34df8ae8861d395630b099caa4044bdb98b1b9be (diff)
parent5ad71d70efc725903a4e4077f284caaa3bca7fe1 (diff)
downloadperlweeklychallenge-club-f87e72e5d596f0411c4f0efb7ca1ec219311167b.tar.gz
perlweeklychallenge-club-f87e72e5d596f0411c4f0efb7ca1ec219311167b.tar.bz2
perlweeklychallenge-club-f87e72e5d596f0411c4f0efb7ca1ec219311167b.zip
Merge branch 'manwar:master' into work
Diffstat (limited to 'challenge-337/sgreen/python/test.py')
-rwxr-xr-xchallenge-337/sgreen/python/test.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-337/sgreen/python/test.py b/challenge-337/sgreen/python/test.py
new file mode 100755
index 0000000000..8223307e20
--- /dev/null
+++ b/challenge-337/sgreen/python/test.py
@@ -0,0 +1,25 @@
+#!/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([6, 5, 4, 8]), [2, 1, 0, 3])
+ self.assertEqual(ch_1.smaller_than_current([7, 7, 7, 7]), [3, 3, 3, 3])
+ self.assertEqual(ch_1.smaller_than_current([5, 4, 3, 2, 1]), [4, 3, 2, 1, 0])
+ self.assertEqual(ch_1.smaller_than_current([-1, 0, 3, -2, 1]), [1, 2, 4, 0, 3])
+ self.assertEqual(ch_1.smaller_than_current([0, 1, 1, 2, 0]), [1, 3, 3, 4, 1])
+
+ def test_ch_2(self):
+ self.assertEqual(ch_2.odd_matrix(2, 3, [[0,1],[1,1]]), 6)
+ self.assertEqual(ch_2.odd_matrix(2, 2, [[1,1],[0,0]]), 0)
+ self.assertEqual(ch_2.odd_matrix(3, 3, [[0,0],[1,2],[2,1]]), 0)
+ self.assertEqual(ch_2.odd_matrix(1, 5, [[0,2],[0,4]]), 2)
+ self.assertEqual(ch_2.odd_matrix(4, 2, [[1,0],[3,1],[2,0],[0,1]]), 8)
+
+
+if __name__ == '__main__':
+ unittest.main()