MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestLongestCommonSubsequence

Function TestLongestCommonSubsequence

dynamic/longestcommonsubsequence_test.go:36–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestLongestCommonSubsequence(t *testing.T) {
37 t.Run("Simple test", func(t *testing.T) {
38 for _, tc := range getLCSTestCases() {
39 actual := dynamic.LongestCommonSubsequence(tc.stringA, tc.stringB)
40 if actual != tc.expected {
41 t.Errorf("expected: %d, but got: %d", tc.expected, actual)
42 }
43 }
44 })
45
46 t.Run("Symmetry test", func(t *testing.T) {
47 for _, tc := range getLCSTestCases() {
48 actual := dynamic.LongestCommonSubsequence(tc.stringB, tc.stringA)
49 if actual != tc.expected {
50 t.Errorf("expected: %d, but got: %d", tc.expected, actual)
51 }
52 }
53 })
54}

Callers

nothing calls this directly

Calls 2

LongestCommonSubsequenceFunction · 0.92
getLCSTestCasesFunction · 0.85

Tested by

no test coverage detected