2017-03-30 17:43:16 +08:00
|
|
|
from nose.tools import assert_equal, assert_raises
|
|
|
|
|
|
|
|
|
|
|
|
class TestFindDiff(object):
|
|
|
|
|
|
|
|
def test_find_diff(self):
|
|
|
|
solution = Solution()
|
|
|
|
assert_raises(TypeError, solution.find_diff, None)
|
2018-08-22 11:02:58 +08:00
|
|
|
assert_equal(solution.find_diff('ab', 'aab'), 'a')
|
|
|
|
assert_equal(solution.find_diff('aab', 'ab'), 'a')
|
2017-03-30 17:43:16 +08:00
|
|
|
assert_equal(solution.find_diff('abcd', 'abcde'), 'e')
|
|
|
|
assert_equal(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')
|
2018-08-22 11:02:58 +08:00
|
|
|
assert_equal(solution.find_diff_xor('ab', 'aab'), 'a')
|
|
|
|
assert_equal(solution.find_diff_xor('aab', 'ab'), 'a')
|
|
|
|
assert_equal(solution.find_diff_xor('abcd', 'abcde'), 'e')
|
|
|
|
assert_equal(solution.find_diff_xor('aaabbcdd', 'abdbacade'), 'e')
|
2017-03-30 17:43:16 +08:00
|
|
|
print('Success: test_find_diff')
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
test = TestFindDiff()
|
|
|
|
test.test_find_diff()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|