summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py
diff options
context:
space:
mode:
authorHaidong Ji2018-12-25 16:42:27 -0600
committerHaidong Ji2018-12-25 16:42:27 -0600
commit61ffe2a9e5fd066dae82a32185bbfe821696bd8a (patch)
tree142ea3876ce900c72d023dd3ea3cff32efbef473 /AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py
parentb12193500c0da24a9e7fc5a8523ed2252da88bad (diff)
Longest subsequence done! (3 seqs)
The only tricky part was to create and populate the 3-d list. The instructions here was helpful: https://www.ict.social/python/basics/multidimensional-lists-in-python
Diffstat (limited to 'AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py')
-rw-r--r--AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py b/AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py
new file mode 100644
index 0000000..c5cf51e
--- /dev/null
+++ b/AlgoDesignAndTechniqueEdxPython/tests/lcs3Test.py
@@ -0,0 +1,28 @@
+'''
+Created on Dec 25, 2018
+
+@author: haidong
+'''
+import unittest
+
+from sources.lcs3 import getLCS3
+
+
+class Test(unittest.TestCase):
+
+ def testName(self):
+ a = [1, 2, 3]
+ b = [2, 1, 3]
+ c = [1, 3, 5]
+ self.assertEqual(2, getLCS3(a, b, c))
+
+ def testName1(self):
+ a = [8, 3, 2, 1, 7]
+ b = [8, 2, 1, 3, 8, 10, 7]
+ c = [6, 8, 3, 1, 4, 7]
+ self.assertEqual(3, getLCS3(a, b, c))
+
+
+if __name__ == "__main__":
+ # import sys;sys.argv = ['', 'Test.testName']
+ unittest.main()