aboutsummaryrefslogtreecommitdiff
path: root/challenge-323/sgreen/python/test.py
diff options
context:
space:
mode:
authorSimon Green <mail@simon.green>2025-06-01 22:54:52 +1000
committerSimon Green <mail@simon.green>2025-06-01 22:54:52 +1000
commit08dd8bb4e98654546426dfa427943a5670912745 (patch)
tree51b7bba76a8d4afc12863ac8600f7b3389ea16ef /challenge-323/sgreen/python/test.py
parent0729d1308bfe2e7d4fc1ea6f41b40356645d4f72 (diff)
downloadperlweeklychallenge-club-08dd8bb4e98654546426dfa427943a5670912745.tar.gz
perlweeklychallenge-club-08dd8bb4e98654546426dfa427943a5670912745.tar.bz2
perlweeklychallenge-club-08dd8bb4e98654546426dfa427943a5670912745.zip
sgreen solutions to challenge 323
Diffstat (limited to 'challenge-323/sgreen/python/test.py')
-rwxr-xr-xchallenge-323/sgreen/python/test.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-323/sgreen/python/test.py b/challenge-323/sgreen/python/test.py
new file mode 100755
index 0000000000..ac48d28290
--- /dev/null
+++ b/challenge-323/sgreen/python/test.py
@@ -0,0 +1,22 @@
+#!/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.increment_decrement(["--x", "x++", "x++"]), 1)
+ self.assertEqual(ch_1.increment_decrement(["x++", "++x", "x++"]), 3)
+ self.assertEqual(ch_1.increment_decrement(["x++", "++x", "--x", "x--"]), 0)
+
+ def test_ch_2(self):
+ self.assertEqual(ch_2.tax_amount(10, [[3, 50], [7, 10], [12,25]]), 2.65)
+ self.assertEqual(ch_2.tax_amount(2, [[1, 0], [4, 25], [5,50]]), 0.25)
+ self.assertEqual(ch_2.tax_amount(0, [[2, 50]]), 0)
+
+
+if __name__ == '__main__':
+ unittest.main()