summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxPython/tests
diff options
context:
space:
mode:
Diffstat (limited to 'AlgoDesignAndTechniqueEdxPython/tests')
-rw-r--r--AlgoDesignAndTechniqueEdxPython/tests/placing_parenTest.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxPython/tests/placing_parenTest.py b/AlgoDesignAndTechniqueEdxPython/tests/placing_parenTest.py
new file mode 100644
index 0000000..7463182
--- /dev/null
+++ b/AlgoDesignAndTechniqueEdxPython/tests/placing_parenTest.py
@@ -0,0 +1,32 @@
+'''
+Created on Dec 28, 2018
+
+@author: haidong
+'''
+import unittest
+
+from sources.placing_paren import getMaxValue
+
+
+class Test(unittest.TestCase):
+
+ def testName(self):
+ exp = "1+5"
+ self.assertEqual(6, getMaxValue(exp))
+
+ def testName1(self):
+ exp = "5-8+7*4-8+9"
+ self.assertEqual(200, getMaxValue(exp))
+
+ def testName2(self):
+ exp = "1+2-3*4-5"
+ self.assertEqual(6, getMaxValue(exp))
+
+ def testName3(self):
+ exp = "1+2*3"
+ self.assertEqual(9, getMaxValue(exp))
+
+
+if __name__ == "__main__":
+ # import sys;sys.argv = ['', 'Test.testName']
+ unittest.main()