Skip to content

Commit 1c34f7d

Browse files
committed
test: add more tests
1 parent 432646b commit 1c34f7d

File tree

20 files changed

+114
-12
lines changed

20 files changed

+114
-12
lines changed

.templates/leetcode/json/accounts_merge.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"name": "test_accounts_merge",
4141
"signature": "(self, accounts: list[list[str]], expected: list[list[str]])",
4242
"parametrize": "accounts, expected",
43-
"test_cases": "[([[\"John\", \"johnsmith@mail.com\", \"john_newyork@mail.com\"], [\"John\", \"johnsmith@mail.com\", \"john00@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]], [[\"John\", \"john00@mail.com\", \"john_newyork@mail.com\", \"johnsmith@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]]), ([[\"Gabe\", \"Gabe0@m.co\", \"Gabe3@m.co\", \"Gabe1@m.co\"], [\"Kevin\", \"Kevin3@m.co\", \"Kevin5@m.co\", \"Kevin0@m.co\"], [\"Ethan\", \"Ethan5@m.co\", \"Ethan4@m.co\", \"Ethan0@m.co\"], [\"Hanzo\", \"Hanzo3@m.co\", \"Hanzo1@m.co\", \"Hanzo0@m.co\"], [\"Fern\", \"Fern5@m.co\", \"Fern1@m.co\", \"Fern0@m.co\"]], [[\"Ethan\", \"Ethan0@m.co\", \"Ethan4@m.co\", \"Ethan5@m.co\"], [\"Gabe\", \"Gabe0@m.co\", \"Gabe1@m.co\", \"Gabe3@m.co\"], [\"Hanzo\", \"Hanzo0@m.co\", \"Hanzo1@m.co\", \"Hanzo3@m.co\"], [\"Kevin\", \"Kevin0@m.co\", \"Kevin3@m.co\", \"Kevin5@m.co\"], [\"Fern\", \"Fern0@m.co\", \"Fern1@m.co\", \"Fern5@m.co\"]]), ([[\"John\", \"john@mail.com\"]], [[\"John\", \"john@mail.com\"]]), ([[\"John\"]], [[\"John\"]]), ([[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]], [[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]]), ([[\"John\", \"a@mail.com\", \"b@mail.com\"], [\"John\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]], [[\"John\", \"a@mail.com\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]]), ([[\"Alice\", \"alice@mail.com\", \"alice1@mail.com\"], [\"Alice\", \"alice2@mail.com\", \"alice3@mail.com\"], [\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\"]], [[\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\", \"alice3@mail.com\", \"alice@mail.com\"]]), ([[\"John\", \"shared@mail.com\"], [\"Jane\", \"shared@mail.com\"]], [[\"John\", \"shared@mail.com\"]])]",
43+
"test_cases": "[([[\"John\", \"johnsmith@mail.com\", \"john_newyork@mail.com\"], [\"John\", \"johnsmith@mail.com\", \"john00@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]], [[\"John\", \"john00@mail.com\", \"john_newyork@mail.com\", \"johnsmith@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]]), ([[\"Gabe\", \"Gabe0@m.co\", \"Gabe3@m.co\", \"Gabe1@m.co\"], [\"Kevin\", \"Kevin3@m.co\", \"Kevin5@m.co\", \"Kevin0@m.co\"], [\"Ethan\", \"Ethan5@m.co\", \"Ethan4@m.co\", \"Ethan0@m.co\"], [\"Hanzo\", \"Hanzo3@m.co\", \"Hanzo1@m.co\", \"Hanzo0@m.co\"], [\"Fern\", \"Fern5@m.co\", \"Fern1@m.co\", \"Fern0@m.co\"]], [[\"Ethan\", \"Ethan0@m.co\", \"Ethan4@m.co\", \"Ethan5@m.co\"], [\"Gabe\", \"Gabe0@m.co\", \"Gabe1@m.co\", \"Gabe3@m.co\"], [\"Hanzo\", \"Hanzo0@m.co\", \"Hanzo1@m.co\", \"Hanzo3@m.co\"], [\"Kevin\", \"Kevin0@m.co\", \"Kevin3@m.co\", \"Kevin5@m.co\"], [\"Fern\", \"Fern0@m.co\", \"Fern1@m.co\", \"Fern5@m.co\"]]), ([[\"John\", \"john@mail.com\"]], [[\"John\", \"john@mail.com\"]]), ([[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]], [[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]]), ([[\"John\", \"a@mail.com\", \"b@mail.com\"], [\"John\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]], [[\"John\", \"a@mail.com\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]]), ([[\"Alice\", \"alice@mail.com\", \"alice1@mail.com\"], [\"Alice\", \"alice2@mail.com\", \"alice3@mail.com\"], [\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\"]], [[\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\", \"alice3@mail.com\", \"alice@mail.com\"]]), ([[\"Bob\", \"bob@mail.com\"], [\"Bob\", \"bob@mail.com\"]], [[\"Bob\", \"bob@mail.com\"]]), ([[\"David\", \"david1@mail.com\", \"david2@mail.com\"], [\"David\", \"david3@mail.com\"], [\"David\", \"david2@mail.com\", \"david4@mail.com\"]], [[\"David\", \"david1@mail.com\", \"david2@mail.com\", \"david4@mail.com\"], [\"David\", \"david3@mail.com\"]]), ([[\"Alex\", \"alex@mail.com\"], [\"Alex\", \"alex@mail.com\", \"alex2@mail.com\"], [\"Alex\", \"alex3@mail.com\"]], [[\"Alex\", \"alex2@mail.com\", \"alex@mail.com\"], [\"Alex\", \"alex3@mail.com\"]]), ([[\"Tom\", \"tom1@mail.com\"], [\"Tom\", \"tom2@mail.com\"], [\"Tom\", \"tom3@mail.com\"], [\"Tom\", \"tom4@mail.com\"]], [[\"Tom\", \"tom1@mail.com\"], [\"Tom\", \"tom2@mail.com\"], [\"Tom\", \"tom3@mail.com\"], [\"Tom\", \"tom4@mail.com\"]]), ([[\"Sam\", \"sam@mail.com\", \"sam1@mail.com\", \"sam2@mail.com\"]], [[\"Sam\", \"sam@mail.com\", \"sam1@mail.com\", \"sam2@mail.com\"]])]",
4444
"body": " result = run_accounts_merge(Solution, accounts)\n assert_accounts_merge(result, expected)"
4545
}
4646
],

.templates/leetcode/json/balanced_binary_tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"name": "test_is_balanced",
5454
"signature": "(self, root_list: list[int | None], expected: bool)",
5555
"parametrize": "root_list, expected",
56-
"test_cases": "[([3, 9, 20, None, None, 15, 7], True), ([1, 2, 2, 3, 3, None, None, 4, 4], False), ([], True), ([1], True), ([1, 2], True), ([1, None, 2], True), ([1, 2, 3, 4], True), ([1, 2, 2, 3, None, None, 3, 4, None, None, 4], False)]",
56+
"test_cases": "[([3, 9, 20, None, None, 15, 7], True), ([1, 2, 2, 3, 3, None, None, 4, 4], False), ([], True), ([1], True), ([1, 2], True), ([1, None, 2], True), ([1, 2, 3, 4], True), ([1, 2, 2, 3, None, None, 3, 4, None, None, 4], False), ([1, 2, 3], True), ([1, 2, None, 3], False), ([1, None, 2, None, 3], False), ([1, 2, 3, 4, 5, 6, 7], True), ([1, 2, 3, None, None, 4, None, None, 5], False), ([5, 1, 4, None, None, 3, 6], True), ([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, None, None, 5, 5], True)]",
5757
"body": " result = run_is_balanced(Solution, root_list)\n assert_is_balanced(result, expected)"
5858
}
5959
]

.templates/leetcode/json/best_time_to_buy_and_sell_stock.json

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

.templates/leetcode/json/invert_binary_tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"name": "test_invert_tree",
5050
"signature": "(self, root_list: list[int | None], expected_list: list[int | None])",
5151
"parametrize": "root_list, expected_list",
52-
"test_cases": "[([4, 2, 7, 1, 3, 6, 9], [4, 7, 2, 9, 6, 3, 1]), ([2, 1, 3], [2, 3, 1]), ([], []), ([1], [1]), ([1, 2], [1, None, 2]), ([1, None, 2], [1, 2]), ([1, 2, 3, 4, 5], [1, 3, 2, None, None, 5, 4]), ([1, 2, 3, None, None, 4, 5], [1, 3, 2, 5, 4])]",
52+
"test_cases": "[([4, 2, 7, 1, 3, 6, 9], [4, 7, 2, 9, 6, 3, 1]), ([2, 1, 3], [2, 3, 1]), ([], []), ([1], [1]), ([1, 2], [1, None, 2]), ([1, None, 2], [1, 2]), ([1, 2, 3, 4, 5], [1, 3, 2, None, None, 5, 4]), ([1, 2, 3, None, None, 4, 5], [1, 3, 2, 5, 4]), ([1, 2, 3, 4, 5, 6, 7], [1, 3, 2, 7, 6, 5, 4]), ([5, 3, 8, 2, 4, 7, 9], [5, 8, 3, 9, 7, 4, 2]), ([10, 5, 15, None, 6, 12, 20], [10, 15, 5, 20, 12, 6]), ([1, 2, None, 3], [1, None, 2, None, 3]), ([0, -1, 1], [0, 1, -1]), ([100, 50, 150], [100, 150, 50]), ([1, 2, 3, None, 4, None, 5], [1, 3, 2, 5, None, 4])]",
5353
"body": " result = run_invert_tree(Solution, root_list)\n assert_invert_tree(result, expected_list)"
5454
}
5555
]

.templates/leetcode/json/maximum_depth_of_binary_tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"name": "test_max_depth",
5151
"signature": "(self, root_list: list[int | None], expected: int)",
5252
"parametrize": "root_list, expected",
53-
"test_cases": "[([3, 9, 20, None, None, 15, 7], 3), ([1, None, 2], 2), ([], 0), ([1], 1), ([1, 2], 2), ([1, 2, 3], 2), ([1, 2, 3, 4], 3), ([1, None, 2, None, 3], 3)]",
53+
"test_cases": "[([3, 9, 20, None, None, 15, 7], 3), ([1, None, 2], 2), ([], 0), ([1], 1), ([1, 2], 2), ([1, 2, 3], 2), ([1, 2, 3, 4], 3), ([1, None, 2, None, 3], 3), ([1, 2, 3, 4, 5, 6, 7], 3), ([1, 2, None, 4, None, None, None, 8], 3), ([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1], 4), ([1, 2, 3, None, None, 4, 5, None, None, 6], 4), ([10], 1), ([1, 2, 2, 3, 3, 3, 3], 3), ([0, -1, 1, -2, -1, 0, 2], 3)]",
5454
"body": " result = run_max_depth(Solution, root_list)\n assert_max_depth(result, expected)"
5555
}
5656
]

.templates/leetcode/json/serialize_and_deserialize_binary_tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"name": "test_serialize_deserialize",
5959
"signature": "(self, root_list: list[int | None])",
6060
"parametrize": "root_list",
61-
"test_cases": "[([1, 2, 3, None, None, 4, 5]), ([]), ([1]), ([1, 2]), ([1, None, 2]), ([1, 2, 3, 4, 5, 6, 7]), ([5, 2, 3, None, None, 2, 4, 3, 1])]",
61+
"test_cases": "[([1, 2, 3, None, None, 4, 5]), ([]), ([1]), ([1, 2]), ([1, None, 2]), ([1, 2, 3, 4, 5, 6, 7]), ([5, 2, 3, None, None, 2, 4, 3, 1]), ([1, 2, 3]), ([1, None, None]), ([1, 2, None, 4]), ([1, None, 2, None, 3]), ([10, 5, 15, None, 6, 12, 20]), ([0, -1, 1]), ([100]), ([1, 2, 3, 4, None, None, 7, 8])]",
6262
"body": " result = run_serialize_deserialize(Codec, root_list)\n assert_serialize_deserialize(result, root_list)"
6363
}
6464
]

.templates/leetcode/json/spiral_matrix.json

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

.templates/leetcode/json/valid_palindrome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"name": "test_is_palindrome",
5656
"signature": "(self, s: str, expected: bool)",
5757
"parametrize": "s, expected",
58-
"test_cases": "[(\"A man, a plan, a canal: Panama\", True), (\"race a car\", False), (\" \", True), (\"\", True), (\"a\", True), (\"Madam\", True), (\"No 'x' in Nixon\", True), (\"Mr. Owl ate my metal worm\", True)]",
58+
"test_cases": "[(\"A man, a plan, a canal: Panama\", True), (\"race a car\", False), (\" \", True), (\"\", True), (\"a\", True), (\"Madam\", True), (\"No 'x' in Nixon\", True), (\"Mr. Owl ate my metal worm\", True), (\"Was it a car or a cat I saw?\", True), (\"Madam, I'm Adam\", True), (\"Never odd or even\", True), (\"Do geese see God?\", True), (\"Step on no pets\", True), (\"12321\", True), (\"hello\", False), (\"ab\", False)]",
5959
"body": " result = run_is_palindrome(Solution, s)\n assert_is_palindrome(result, expected)"
6060
}
6161
]

.templates/leetcode/json/valid_parentheses.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"name": "test_is_valid",
5252
"signature": "(self, s: str, expected: bool)",
5353
"parametrize": "s, expected",
54-
"test_cases": "[('()', True), ('()[]{}', True), ('(]', False), ('([])', True), ('([)]', False), ('', True), ('(', False), (')', False), ('{[()]}', True), ('{[(])}', False)]",
54+
"test_cases": "[('()', True), ('()[]{}', True), ('(]', False), ('([])', True), ('([)]', False), ('', True), ('(', False), (')', False), ('{[()]}', True), ('{[(])}', False), ('((', False), ('))', False), ('([{}])', True), ('([{]})', False), ('{[}]', False), ('((()))', True), ('((())', False), ('(){}[]', True), ('{[(', False), (']})', False)]",
5555
"body": " result = run_is_valid(Solution, s)\n assert_is_valid(result, expected)"
5656
}
5757
]

.templates/leetcode/json/zero_one_matrix.json

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

0 commit comments

Comments
 (0)