summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java
diff options
context:
space:
mode:
authorHaidong Ji2018-12-23 16:02:16 -0600
committerHaidong Ji2018-12-23 16:02:16 -0600
commitc4ef43d3e77450b45bb7fb988bff0923ef8276fe (patch)
tree97804b2515f2d7eb3fdd7ac455dbcb8e544ba65a /AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java
parent4c1b19574b95e9db2c65f72b94bc55a86e4d6687 (diff)
Longest Common Subsequence of two sequences not done
I do want to record this because the algos were written based on lecture slides, and it passed all my own tests. However, it didn't pass test 14 of 37 from course grader. I checked forums in both edX and Coursera, I was not alone in having that issue, but neither forums provided the answer to the 14th test case used by the grader.
Diffstat (limited to 'AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java')
-rw-r--r--AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java b/AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java
new file mode 100644
index 0000000..bdfa799
--- /dev/null
+++ b/AlgoDesignAndTechniqueEdxJava/tests/LCS2Test.java
@@ -0,0 +1,35 @@
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+class LCS2Test {
+
+ @Test
+ void test() {
+ int[] a = {2, 7, 5};
+ int[] b = {2, 5};
+ assertEquals(2, LCS2.lcs2(a,b));
+ }
+
+ @Test
+ void test1() {
+ int[] a = {7};
+ int[] b = {1, 2, 3, 4};
+ assertEquals(0, LCS2.lcs2(a,b));
+ }
+
+ @Test
+ void test2() {
+ int[] a = {2, 7, 8, 3};
+ int[] b = {5, 2, 8, 7};
+ assertEquals(2, LCS2.lcs2(a,b));
+ }
+
+ @Test
+ void test3() {
+ int[] a = {1, 2, 3, 4, 5, 6, 7};
+ int[] b = {1, 2, 8, 4, 5, 6};
+ assertEquals(5, LCS2.lcs2(a,b));
+ }
+
+}