mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Add duplicate-characters test for permutations (#158)
Summary: The current test cases for the "string permutation checker" problem do not include a test case where the inputs have the same elements at different multiplicities. Without this test case, the implementation return s1 is not None and s2 is not None and set(s1) == set(s2) would pass all tests. Test Plan: First, change one of the implementations to the above implementation, and see that the original tests still pass. Then, apply this patch to add the new test case. Then, revert the implementation change to see all tests pass again.
This commit is contained in:
parent
f2ff4d7982
commit
556a9adc11
|
@ -58,7 +58,8 @@
|
|||
"* One or more empty strings -> False\n",
|
||||
"* 'Nib', 'bin' -> False\n",
|
||||
"* 'act', 'cat' -> True\n",
|
||||
"* 'a ct', 'ca t' -> True"
|
||||
"* 'a ct', 'ca t' -> True\n",
|
||||
"* 'dog', 'doggo' -> False"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -200,6 +201,7 @@
|
|||
" assert_equal(func('Nib', 'bin'), False)\n",
|
||||
" assert_equal(func('act', 'cat'), True)\n",
|
||||
" assert_equal(func('a ct', 'ca t'), True)\n",
|
||||
" assert_equal(func('dog', 'doggo'), False)\n",
|
||||
" print('Success: test_permutation')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
|
|
|
@ -9,6 +9,7 @@ class TestPermutation(object):
|
|||
assert_equal(func('Nib', 'bin'), False)
|
||||
assert_equal(func('act', 'cat'), True)
|
||||
assert_equal(func('a ct', 'ca t'), True)
|
||||
assert_equal(func('dog', 'doggo'), False)
|
||||
print('Success: test_permutation')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user