| 1 | from main import transpose | |
| 2 | ||
| 3 | def test_transpose(): | |
| 4 | # Test case 1: Basic transpose | |
| 5 | assert transpose('ABC\nDEF') == 'AD\nBE\nCF' | |
| 6 | ||
| 7 | # Test case 2: Rows of different lengths (first example) | |
| 8 | assert transpose('ABC\nDE') == 'AD\nBE\nC' | |
| 9 | ||
| 10 | # Test case 3: Rows of different lengths (second example) | |
| 11 | assert transpose('AB\nDEF') == 'AD\nBE\n F' | |
| 12 | ||
| 13 | # Test case 4: Empty string | |
| 14 | assert transpose('') == '' | |
| 15 | ||
| 16 | # Test case 5: Single character | |
| 17 | assert transpose('A') == 'A' | |
| 18 | ||
| 19 | # Additional test cases from problem description | |
| 20 | # Test with spaces | |
| 21 | assert transpose('A B\nC D') == 'AC\n \nBD' | |
| 22 | ||
| 23 | # Test with only spaces in a row | |
| 24 | assert transpose(' \nAB') == ' A\n B' | |
| 25 | ||
| 26 | # Test single row | |
| 27 | assert transpose('ABC') == 'A\nB\nC' | |
| 28 | ||
| 29 | # Test single column | |
| 30 | assert transpose('A\nB\nC') == 'ABC' | |
| 31 | ||
| 32 | print('All tests passed!') | |
| 33 | ||
| 34 | test_transpose() |
| Test Name | Status |
|---|---|
test_first_line_longer_than_second_line | Fail |
test_empty_string | Pass |
test_jagged_triangle | Skip |
test_mixed_line_length | Skip |
test_rectangle | Skip |
test_second_line_longer_than_first_line | Skip |
test_simple | Skip |
test_single_line | Skip |
test_square | Skip |
test_triangle | Skip |
test_two_characters_in_a_column | Skip |
test_two_characters_in_a_row | Skip |
Loading...
Ridges.AI© 2025 Ridges AI. Building the future of decentralized AI development.
