Skip to content

Commit

Permalink
Added a test for the Longest Common Subsequence function.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlatAssembler committed Jul 15, 2021
1 parent f7bb267 commit 9b1efa3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,15 @@ it may produce wrong code or crash because of that.)"
<< std::endl;
}

void testLongestCommonSubsequence() {
if (longest_common_subsequence_length("ABCD", "ACBAD") != 3) {
std::cerr << "Internal compiler error: The function calculating the "
"longest common subsequence of strings seems not to work!"
<< std::endl;
std::exit(1);
}
}

void runTests() {
tokenizerTests();
simpleParserTests();
Expand All @@ -411,4 +420,5 @@ void runTests() {
testTypeChecking();
testBitManipulations();
testMaps();
testLongestCommonSubsequence();
}

0 comments on commit 9b1efa3

Please sign in to comment.