-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_move_zeroes.py
More file actions
31 lines (25 loc) · 933 Bytes
/
Copy pathtest_move_zeroes.py
File metadata and controls
31 lines (25 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unittest
from typing import List
from parameterized import parameterized
from algorithms.two_pointers.move_zeroes import move_zeroes, move_zeroes_one
MOVE_ZEROES_TEST_CASES = [
([0, 1, 0, 3, 12], [1, 3, 12, 0, 0]),
([0], [0]),
([0, 0, 0], [0, 0, 0]),
([1, 0], [1, 0]),
([2, 0, 4, 0, 9], [2, 4, 9, 0, 0]),
([1, 0, 4, 0, 3, 0, 1], [1, 4, 3, 1, 0, 0, 0]),
([0, 0, 1], [1, 0, 0]),
([1, 2, 3], [1, 2, 3]),
]
class MoveZeroesTestCase(unittest.TestCase):
@parameterized.expand(MOVE_ZEROES_TEST_CASES)
def test_move_zeroes(self, nums: List[int], expected: [List]):
move_zeroes(nums)
self.assertEqual(expected, nums)
@parameterized.expand(MOVE_ZEROES_TEST_CASES)
def test_move_zeroes_with_intermediate(self, nums: List[int], expected: List[int]):
move_zeroes_one(nums)
self.assertEqual(expected, nums)
if __name__ == "__main__":
unittest.main()