Change longest common substring to subsequence (#196)

This commit is contained in:
Evan Cameron
2017-05-29 20:50:39 -04:00
committed by Donne Martin
parent 9f89a51aba
commit 00673c0bfd
6 changed files with 52 additions and 52 deletions

View File

@@ -0,0 +1,23 @@
from nose.tools import assert_equal, assert_raises
class TestLongestCommonSubseq(object):
def test_longest_common_subseq(self):
str_comp = StringCompare()
assert_raises(TypeError, str_comp.longest_common_subseq, None, None)
assert_equal(str_comp.longest_common_subseq('', ''), '')
str0 = 'ABCDEFGHIJ'
str1 = 'FOOBCDBCDE'
expected = 'BCDE'
assert_equal(str_comp.longest_common_subseq(str0, str1), expected)
print('Success: test_longest_common_subseq')
def main():
test = TestLongestCommonSubseq()
test.test_longest_common_subseq()
if __name__ == '__main__':
main()