aboutsummaryrefslogtreecommitdiff
path: root/challenge-323/sgreen/python/test.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-06-01 22:54:44 +0100
committerGitHub <noreply@github.com>2025-06-01 22:54:44 +0100
commit72a1c60daab582b75fc1439c852a7c868adc0172 (patch)
tree11330f178a2108df26455ca98592d415c28a54c9 /challenge-323/sgreen/python/test.py
parent3517294cda226112a6cddb4ab8c76f285694ad83 (diff)
parent08dd8bb4e98654546426dfa427943a5670912745 (diff)
downloadperlweeklychallenge-club-72a1c60daab582b75fc1439c852a7c868adc0172.tar.gz
perlweeklychallenge-club-72a1c60daab582b75fc1439c852a7c868adc0172.tar.bz2
perlweeklychallenge-club-72a1c60daab582b75fc1439c852a7c868adc0172.zip
Merge pull request #12111 from simongreen-net/master
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()