mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Test for inplace modification of the array.
This commit is contained in:
parent
7063af0022
commit
2fd239fbeb
|
@ -121,10 +121,17 @@
|
||||||
" ['r', 'a', 'b', ' ', 'o', 'o', 'f'])\n",
|
" ['r', 'a', 'b', ' ', 'o', 'o', 'f'])\n",
|
||||||
" print('Success: test_reverse')\n",
|
" print('Success: test_reverse')\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
" def test_reverse_inplace(self):\n",
|
||||||
|
" target_list = ['f', 'o', 'o', ' ', 'b', 'a', 'r']\n",
|
||||||
|
" list_of_chars(target_list)\n",
|
||||||
|
" assert_equal(target_list, ['r', 'a', 'b', ' ', 'o', 'o', 'f'])\n",
|
||||||
|
" print('Success: test_reverse_inplace')\n",
|
||||||
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def main():\n",
|
"def main():\n",
|
||||||
" test = TestReverse()\n",
|
" test = TestReverse()\n",
|
||||||
" test.test_reverse()\n",
|
" test.test_reverse()\n",
|
||||||
|
" test.test_reverse_inplace()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"if __name__ == '__main__':\n",
|
"if __name__ == '__main__':\n",
|
||||||
|
|
|
@ -11,10 +11,17 @@ class TestReverse(object):
|
||||||
['r', 'a', 'b', ' ', 'o', 'o', 'f'])
|
['r', 'a', 'b', ' ', 'o', 'o', 'f'])
|
||||||
print('Success: test_reverse')
|
print('Success: test_reverse')
|
||||||
|
|
||||||
|
def test_reverse_inplace(self):
|
||||||
|
target_list = ['f', 'o', 'o', ' ', 'b', 'a', 'r']
|
||||||
|
list_of_chars(target_list)
|
||||||
|
assert_equal(target_list, ['r', 'a', 'b', ' ', 'o', 'o', 'f'])
|
||||||
|
print('Success: test_reverse_inplace')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
test = TestReverse()
|
test = TestReverse()
|
||||||
test.test_reverse()
|
test.test_reverse()
|
||||||
|
test.test_reverse_inplace()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user