Skip to content

Commit 556a9ad

Browse files
wchargindonnemartin
authored andcommitted
Add duplicate-characters test for permutations (donnemartin#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.
1 parent f2ff4d7 commit 556a9ad

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

arrays_strings/permutation/permutation_solution.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"* One or more empty strings -> False\n",
5959
"* 'Nib', 'bin' -> False\n",
6060
"* 'act', 'cat' -> True\n",
61-
"* 'a ct', 'ca t' -> True"
61+
"* 'a ct', 'ca t' -> True\n",
62+
"* 'dog', 'doggo' -> False"
6263
]
6364
},
6465
{
@@ -200,6 +201,7 @@
200201
" assert_equal(func('Nib', 'bin'), False)\n",
201202
" assert_equal(func('act', 'cat'), True)\n",
202203
" assert_equal(func('a ct', 'ca t'), True)\n",
204+
" assert_equal(func('dog', 'doggo'), False)\n",
203205
" print('Success: test_permutation')\n",
204206
"\n",
205207
"\n",

arrays_strings/permutation/test_permutation_solution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def test_permutation(self, func):
99
assert_equal(func('Nib', 'bin'), False)
1010
assert_equal(func('act', 'cat'), True)
1111
assert_equal(func('a ct', 'ca t'), True)
12+
assert_equal(func('dog', 'doggo'), False)
1213
print('Success: test_permutation')
1314

1415

0 commit comments

Comments
 (0)