Skip to content

Commit e6c468d

Browse files
committed
test: add more test cases
1 parent 1c34f7d commit e6c468d

File tree

24 files changed

+91
-13
lines changed

24 files changed

+91
-13
lines changed

.templates/leetcode/json/climbing_stairs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"name": "test_climb_stairs",
5353
"signature": "(self, n: int, expected: int)",
5454
"parametrize": "n, expected",
55-
"test_cases": "[(1, 1), (2, 2), (3, 3), (4, 5), (5, 8), (6, 13), (10, 89), (20, 10946), (45, 1836311903)]",
55+
"test_cases": "[(1, 1), (2, 2), (3, 3), (4, 5), (5, 8), (6, 13), (7, 21), (8, 34), (9, 55), (10, 89), (15, 987), (20, 10946), (25, 121393), (30, 1346269), (35, 14930352), (40, 165580141), (45, 1836311903)]",
5656
"body": " result = run_climb_stairs(Solution, n)\n assert_climb_stairs(result, expected)"
5757
}
5858
]

.templates/leetcode/json/coin_change.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"name": "test_coin_change",
5252
"signature": "(self, coins: list[int], amount: int, expected: int)",
5353
"parametrize": "coins, amount, expected",
54-
"test_cases": "[([1, 2, 5], 11, 3), ([2], 3, -1), ([1], 0, 0), ([1, 3, 4], 6, 2), ([2, 5, 10, 1], 27, 4), ([5], 3, -1), ([1], 1, 1), ([1, 2], 2, 1), ([186, 419, 83, 408], 6249, 20)]",
54+
"test_cases": "[([1, 2, 5], 11, 3), ([2], 3, -1), ([1], 0, 0), ([1, 3, 4], 6, 2), ([2, 5, 10, 1], 27, 4), ([5], 3, -1), ([1], 1, 1), ([1, 2], 2, 1), ([186, 419, 83, 408], 6249, 20), ([1, 5, 10, 25], 30, 2), ([2, 3, 5], 9, 3), ([1, 4, 5], 8, 2), ([3, 5], 1, -1), ([1, 2, 5], 100, 20), ([7, 11], 14, 2)]",
5555
"body": " result = run_coin_change(Solution, coins, amount)\n assert_coin_change(result, expected)"
5656
}
5757
]

.templates/leetcode/json/first_bad_version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"name": "test_first_bad_version",
5656
"signature": "(self, n: int, bad: int, expected: int)",
5757
"parametrize": "n, bad, expected",
58-
"test_cases": "[(5, 4, 4), (1, 1, 1), (3, 1, 1), (10, 7, 7), (100, 50, 50), (2, 1, 1), (2, 2, 2), (1000, 1, 1), (1000, 999, 999), (1000, 500, 500)]",
58+
"test_cases": "[(5, 4, 4), (1, 1, 1), (3, 1, 1), (10, 7, 7), (100, 50, 50), (2, 1, 1), (2, 2, 2), (1000, 1, 1), (1000, 999, 999), (1000, 500, 500), (20, 15, 15), (50, 25, 25), (8, 3, 3), (16, 9, 9), (200, 150, 150)]",
5959
"body": " result = run_first_bad_version(Solution, n, bad)\n assert_first_bad_version(result, expected)"
6060
}
6161
]

.templates/leetcode/json/linked_list_cycle.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"name": "test_has_cycle",
5656
"signature": "(self, values: list[int], pos: int, expected: bool)",
5757
"parametrize": "values, pos, expected",
58-
"test_cases": "[([3, 2, 0, -4], 1, True), ([1, 2], 0, True), ([1], -1, False), ([], -1, False), ([1, 2, 3], -1, False), ([1, 2, 3, 4, 5], 0, True), ([1, 2, 3, 4, 5], 2, True), ([1, 2, 3, 4, 5], 4, True), ([1], 0, True), ([1, 2], 1, True)]",
58+
"test_cases": "[([3, 2, 0, -4], 1, True), ([1, 2], 0, True), ([1], -1, False), ([], -1, False), ([1, 2, 3], -1, False), ([1, 2, 3, 4, 5], 0, True), ([1, 2, 3, 4, 5], 2, True), ([1, 2, 3, 4, 5], 4, True), ([1], 0, True), ([1, 2], 1, True), ([1, 2, 3, 4], -1, False), ([1, 2, 3, 4, 5, 6], 3, True), ([10, 20, 30], 1, True), ([100], -1, False), ([1, 2, 3, 4, 5, 6, 7, 8], 5, True)]",
5959
"body": " result = run_has_cycle(Solution, values, pos)\n assert_has_cycle(result, expected)"
6060
}
6161
]

.templates/leetcode/json/majority_element.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"name": "test_majority_element",
4949
"signature": "(self, nums: list[int], expected: int)",
5050
"parametrize": "nums, expected",
51-
"test_cases": "[([3,2,3], 3), ([2,2,1,1,1,2,2], 2), ([1], 1), ([1,1,2], 1), ([2,2,2,1,1], 2), ([5,5,5,5,1,2,3], 5), ([1,2,3,4,4,4,4], 4), ([0,0,0], 0), ([-1,-1,-1,1,1], -1)]",
51+
"test_cases": "[([3,2,3], 3), ([2,2,1,1,1,2,2], 2), ([1], 1), ([1,1,2], 1), ([2,2,2,1,1], 2), ([5,5,5,5,1,2,3], 5), ([1,2,3,4,4,4,4], 4), ([0,0,0], 0), ([-1,-1,-1,1,1], -1), ([100,100,100,99,99], 100), ([7,7,7,7,7,8,8], 7), ([1,1,1,1,1,1,2,2,2], 1), ([9,9,9,9,8,8,8], 9), ([-5,-5,-5,-4,-4], -5), ([1000,1000,999,999,1000], 1000)]",
5252
"body": " result = run_majority_element(Solution, nums)\n assert_majority_element(result, expected)"
5353
}
5454
]

.templates/leetcode/json/merge_k_sorted_lists.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"name": "test_merge_k_lists",
5252
"signature": "(self, lists_data: list[list[int]], expected_data: list[int])",
5353
"parametrize": "lists_data, expected_data",
54-
"test_cases": "[([[1, 4, 5], [1, 3, 4], [2, 6]], [1, 1, 2, 3, 4, 4, 5, 6]), ([], []), ([[]], []), ([[1]], [1]), ([[1, 2], [3, 4]], [1, 2, 3, 4]), ([[5], [1, 3], [2, 4, 6]], [1, 2, 3, 4, 5, 6]), ([[-1, 0, 1], [-2, 2]], [-2, -1, 0, 1, 2]), ([[1, 1, 1], [2, 2, 2]], [1, 1, 1, 2, 2, 2]), ([[], [1], []], [1])]",
54+
"test_cases": "[([[1, 4, 5], [1, 3, 4], [2, 6]], [1, 1, 2, 3, 4, 4, 5, 6]), ([], []), ([[]], []), ([[1]], [1]), ([[1, 2], [3, 4]], [1, 2, 3, 4]), ([[5], [1, 3], [2, 4, 6]], [1, 2, 3, 4, 5, 6]), ([[-1, 0, 1], [-2, 2]], [-2, -1, 0, 1, 2]), ([[1, 1, 1], [2, 2, 2]], [1, 1, 1, 2, 2, 2]), ([[], [1], []], [1]), ([[0, 0, 0], [1, 1, 1]], [0, 0, 0, 1, 1, 1]), ([[10], [5], [1]], [1, 5, 10]), ([[1, 2, 3, 4, 5]], [1, 2, 3, 4, 5]), ([[-10, -5], [-8, -3], [-6, -1]], [-10, -8, -6, -5, -3, -1]), ([[100]], [100]), ([[1, 3, 5], [2, 4, 6], [7, 8, 9]], [1, 2, 3, 4, 5, 6, 7, 8, 9])]",
5555
"body": " result = run_merge_k_lists(Solution, lists_data)\n assert_merge_k_lists(result, expected_data)"
5656
}
5757
]

.templates/leetcode/json/minimum_height_trees.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"name": "test_find_min_height_trees",
5353
"signature": "(self, n: int, edges: list[list[int]], expected: list[int])",
5454
"parametrize": "n, edges, expected",
55-
"test_cases": "[(4, [[1, 0], [1, 2], [1, 3]], [1]), (6, [[3, 0], [3, 1], [3, 2], [3, 4], [5, 4]], [3, 4]), (1, [], [0]), (2, [[0, 1]], [0, 1]), (3, [[0, 1], [1, 2]], [1]), (5, [[0, 1], [1, 2], [2, 3], [3, 4]], [2]), (7, [[0, 1], [1, 2], [1, 3], [2, 4], [3, 5], [4, 6]], [1, 2]), (6, [[0, 3], [1, 3], [2, 3], [4, 3], [5, 4]], [3, 4]), (10, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]], [4, 5])]",
55+
"test_cases": "[(4, [[1, 0], [1, 2], [1, 3]], [1]), (6, [[3, 0], [3, 1], [3, 2], [3, 4], [5, 4]], [3, 4]), (1, [], [0]), (2, [[0, 1]], [0, 1]), (3, [[0, 1], [1, 2]], [1]), (5, [[0, 1], [1, 2], [2, 3], [3, 4]], [2]), (7, [[0, 1], [1, 2], [1, 3], [2, 4], [3, 5], [4, 6]], [1, 2]), (6, [[0, 3], [1, 3], [2, 3], [4, 3], [5, 4]], [3, 4]), (10, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9]], [4, 5]), (8, [[0, 1], [1, 2], [2, 3], [0, 4], [4, 5], [5, 6], [6, 7]], [0, 4]), (9, [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6], [3, 7], [4, 8]], [0, 1]), (11, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]], [5])]",
5656
"body": " result = run_find_min_height_trees(Solution, n, edges)\n assert_find_min_height_trees(result, expected)"
5757
}
5858
]

.templates/leetcode/json/number_of_islands.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"name": "test_num_islands",
5353
"signature": "(self, grid: list[list[str]], expected: int)",
5454
"parametrize": "grid, expected",
55-
"test_cases": "[([[\"1\", \"1\", \"1\", \"1\", \"0\"], [\"1\", \"1\", \"0\", \"1\", \"0\"], [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"0\", \"0\"]], 1), ([[\"1\", \"1\", \"0\", \"0\", \"0\"], [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"1\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"1\", \"1\"]], 3), ([[\"1\", \"0\", \"1\", \"1\", \"1\"], [\"1\", \"0\", \"1\", \"0\", \"1\"], [\"1\", \"1\", \"1\", \"0\", \"1\"]], 1), ([[\"0\", \"0\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"0\", \"0\"]], 0), ([[\"1\", \"1\", \"1\"], [\"0\", \"1\", \"0\"], [\"1\", \"1\", \"1\"]], 1), ([[\"1\"]], 1), ([[\"0\"]], 0), ([[\"1\", \"0\"], [\"0\", \"1\"]], 2), ([[\"1\", \"1\"], [\"1\", \"1\"]], 1), ([[\"1\", \"0\", \"1\"], [\"0\", \"1\", \"0\"], [\"1\", \"0\", \"1\"]], 5)]",
55+
"test_cases": "[([[\"1\", \"1\", \"1\", \"1\", \"0\"], [\"1\", \"1\", \"0\", \"1\", \"0\"], [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"0\", \"0\"]], 1), ([[\"1\", \"1\", \"0\", \"0\", \"0\"], [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"1\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"1\", \"1\"]], 3), ([[\"1\", \"0\", \"1\", \"1\", \"1\"], [\"1\", \"0\", \"1\", \"0\", \"1\"], [\"1\", \"1\", \"1\", \"0\", \"1\"]], 1), ([[\"0\", \"0\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"0\", \"0\"]], 0), ([[\"1\", \"1\", \"1\"], [\"0\", \"1\", \"0\"], [\"1\", \"1\", \"1\"]], 1), ([[\"1\"]], 1), ([[\"0\"]], 0), ([[\"1\", \"0\"], [\"0\", \"1\"]], 2), ([[\"1\", \"1\"], [\"1\", \"1\"]], 1), ([[\"1\", \"0\", \"1\"], [\"0\", \"1\", \"0\"], [\"1\", \"0\", \"1\"]], 5), ([[\"1\", \"1\", \"0\"], [\"0\", \"0\", \"1\"], [\"0\", \"1\", \"1\"]], 2), ([[\"1\", \"0\", \"0\", \"1\"], [\"0\", \"1\", \"1\", \"0\"], [\"0\", \"1\", \"1\", \"0\"], [\"1\", \"0\", \"0\", \"1\"]], 5), ([[\"0\", \"1\", \"0\"], [\"1\", \"0\", \"1\"], [\"0\", \"1\", \"0\"]], 4), ([[\"1\", \"1\", \"1\", \"1\"], [\"1\", \"0\", \"0\", \"1\"], [\"1\", \"1\", \"1\", \"1\"]], 1)]",
5656
"body": " result = run_num_islands(Solution, grid)\n assert_num_islands(result, expected)"
5757
}
5858
]

.templates/leetcode/json/reverse_linked_list.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"name": "test_reverse_list",
5454
"signature": "(self, head_list: list[int], expected_list: list[int])",
5555
"parametrize": "head_list, expected_list",
56-
"test_cases": "[([1, 2, 3, 4, 5], [5, 4, 3, 2, 1]), ([1, 2], [2, 1]), ([1], [1]), ([], []), ([1, 2, 3], [3, 2, 1]), ([1, 2, 3, 4], [4, 3, 2, 1]), ([-1, -2, -3], [-3, -2, -1]), ([0], [0]), ([5000, -5000], [-5000, 5000]), ([1, 1, 1], [1, 1, 1])]",
56+
"test_cases": "[([1, 2, 3, 4, 5], [5, 4, 3, 2, 1]), ([1, 2], [2, 1]), ([1], [1]), ([], []), ([1, 2, 3], [3, 2, 1]), ([1, 2, 3, 4], [4, 3, 2, 1]), ([-1, -2, -3], [-3, -2, -1]), ([0], [0]), ([5000, -5000], [-5000, 5000]), ([1, 1, 1], [1, 1, 1]), ([10, 20, 30, 40, 50, 60], [60, 50, 40, 30, 20, 10]), ([-100, 0, 100], [100, 0, -100]), ([7], [7]), ([1, 2, 3, 4, 5, 6, 7], [7, 6, 5, 4, 3, 2, 1]), ([42, 42, 42, 42], [42, 42, 42, 42])]",
5757
"body": " result = run_reverse_list(Solution, head_list)\n assert_reverse_list(result, expected_list)"
5858
}
5959
]

.templates/leetcode/json/search_in_rotated_sorted_array.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"name": "test_search",
5050
"signature": "(self, nums: list[int], target: int, expected: int)",
5151
"parametrize": "nums, target, expected",
52-
"test_cases": "[([4, 5, 6, 7, 0, 1, 2], 0, 4), ([4, 5, 6, 7, 0, 1, 2], 3, -1), ([1], 0, -1), ([1], 1, 0), ([3, 1], 1, 1), ([1, 3], 3, 1), ([2, 1], 2, 0), ([5, 1, 3], 3, 2), ([4, 5, 6, 7, 8, 1, 2, 3], 8, 4)]",
52+
"test_cases": "[([4, 5, 6, 7, 0, 1, 2], 0, 4), ([4, 5, 6, 7, 0, 1, 2], 3, -1), ([1], 0, -1), ([1], 1, 0), ([3, 1], 1, 1), ([1, 3], 3, 1), ([2, 1], 2, 0), ([5, 1, 3], 3, 2), ([4, 5, 6, 7, 8, 1, 2, 3], 8, 4), ([6, 7, 0, 1, 2, 3, 4, 5], 6, 0), ([7, 0, 1, 2, 3, 4, 5, 6], 7, 0), ([0, 1, 2, 3, 4, 5, 6, 7], 4, 4), ([3, 4, 5, 6, 7, 0, 1, 2], 2, 7), ([9, 0, 2, 7, 8], 3, -1), ([8, 9, 2, 3, 4], 9, 1)]",
5353
"body": " result = run_search(Solution, nums, target)\n assert_search(result, expected)"
5454
}
5555
]

0 commit comments

Comments
 (0)