mirror of
https://github.com/priyanshujain/messageboardbench.git
synced 2026-10-02 19:17:07 +00:00
35 lines
1.5 KiB
Python
35 lines
1.5 KiB
Python
from func import min_operations_to_rearrange
|
|
|
|
def test_func(candidate):
|
|
# Sample test cases
|
|
assert candidate(6, 'BWBWBW', 'WWWBBB') == 4
|
|
assert candidate(6, 'BBBBBB', 'WWWWWW') == -1
|
|
assert candidate(14, 'BBBWBWWWBBWWBW', 'WBWWBBWWWBWBBB') == 7
|
|
|
|
# Additional test cases
|
|
assert candidate(10, 'BBBBBWBWWW', 'BBWWWWWBBB') == -1
|
|
assert candidate(14, 'WBWBWBWBWBWBWB', 'WWWWWWWBBBBBBB') == 8
|
|
assert candidate(14, 'BWBBBWBBWBBWBB', 'WWWWBBBBBBBBBB') == 8
|
|
assert candidate(14, 'BWBBBBBBBBBBBB', 'WBBBBBBBBBBBBB') == 4
|
|
assert candidate(4, 'WWBB', 'BBWW') == 3
|
|
assert candidate(4, 'BBWW', 'WWBB') == 7
|
|
assert candidate(12, 'WBWWWWBWBBBB', 'BBBBBBWWWWWW') == 8
|
|
assert candidate(3, 'BBW', 'BBW') == 0
|
|
assert candidate(14, 'BWBWWWBBWBWWBW', 'WWWBBBWWBWBWWB') == 9
|
|
assert candidate(3, 'BBW', 'WBB') == -1
|
|
assert candidate(2, 'BW', 'WB') == -1
|
|
assert candidate(2, 'BW', 'BW') == 0
|
|
assert candidate(12, 'WBWBWBWBBBBB', 'BBBBBBBBWWWW') == 8
|
|
assert candidate(14, 'WWWWWWWWWWWWWW', 'WWWWWWWWWWWWWW') == 0
|
|
assert candidate(14, 'BBWBWBBBBBBBBB', 'WWBBBBBBBBBBBB') == 5
|
|
assert candidate(9, 'WBWBWBWWW', 'WWWWWWBBB') == 6
|
|
assert candidate(4, 'WWBB', 'WBWB') == -1
|
|
assert candidate(14, 'WWWWBWWBWWBWWW', 'BBBWWWWWWWWWWW') == 7
|
|
assert candidate(14, 'WBWBBBWWBWBBWB', 'BBBWWWBBWBWBBW') == 9
|
|
assert candidate(4, 'BBWW', 'WWBB') == 3
|
|
assert candidate(14, 'BWBWBWBWBWBWBW', 'BWBWBWBWBWBWBW') == 0
|
|
|
|
if __name__ == "__main__":
|
|
test_func(min_operations_to_rearrange)
|
|
print("All tests passed!")
|