Skip to content

Commit 9b1efa3

Browse files
committed
Added a test for the Longest Common Subsequence function.
1 parent f7bb267 commit 9b1efa3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ it may produce wrong code or crash because of that.)"
401401
<< std::endl;
402402
}
403403

404+
void testLongestCommonSubsequence() {
405+
if (longest_common_subsequence_length("ABCD", "ACBAD") != 3) {
406+
std::cerr << "Internal compiler error: The function calculating the "
407+
"longest common subsequence of strings seems not to work!"
408+
<< std::endl;
409+
std::exit(1);
410+
}
411+
}
412+
404413
void runTests() {
405414
tokenizerTests();
406415
simpleParserTests();
@@ -411,4 +420,5 @@ void runTests() {
411420
testTypeChecking();
412421
testBitManipulations();
413422
testMaps();
423+
testLongestCommonSubsequence();
414424
}

0 commit comments

Comments
 (0)