|
| 1 | +module main |
| 2 | + |
| 3 | +fn test_extract_row_from_one_number_matrix() { |
| 4 | + str := '1' |
| 5 | + assert row(str, 1) == [1] |
| 6 | +} |
| 7 | + |
| 8 | +fn test_can_extract_row() { |
| 9 | + str := '1 2\n3 4' |
| 10 | + assert row(str, 2) == [3, 4] |
| 11 | +} |
| 12 | + |
| 13 | +fn test_extract_row_where_numbers_have_different_widths() { |
| 14 | + str := '1 2\n10 20' |
| 15 | + assert row(str, 2) == [10, 20] |
| 16 | +} |
| 17 | + |
| 18 | +fn test_can_extract_row_from_non_square_matrix_with_no_corresponding_column() { |
| 19 | + str := '1 2 3\n4 5 6\n7 8 9\n8 7 6' |
| 20 | + assert row(str, 4) == [8, 7, 6] |
| 21 | +} |
| 22 | + |
| 23 | +fn test_extract_column_from_one_number_matrix() { |
| 24 | + str := '1' |
| 25 | + assert column(str, 1) == [1] |
| 26 | +} |
| 27 | + |
| 28 | +fn test_can_extract_column() { |
| 29 | + str := '1 2 3\n4 5 6\n7 8 9' |
| 30 | + assert column(str, 3) == [3, 6, 9] |
| 31 | +} |
| 32 | + |
| 33 | +fn test_can_extract_column_from_non_square_matrix_with_no_corresponding_row() { |
| 34 | + str := '1 2 3 4\n5 6 7 8\n9 8 7 6' |
| 35 | + assert column(str, 4) == [4, 8, 6] |
| 36 | +} |
| 37 | + |
| 38 | +fn test_extract_column_where_numbers_have_different_widths() { |
| 39 | + str := '89 1903 3\n18 3 1\n9 4 800' |
| 40 | + assert column(str, 2) == [1903, 3, 4] |
| 41 | +} |
0 commit comments