Skip to content

Commit d496984

Browse files
kytrinyxkotp
authored andcommitted
Sync transpose with problem-specifications
The sync brought in new docs and a new test to tests.toml When regenerating the test suite I removed some blank lines that I didn't feel were adding any readability.
1 parent e64b1ea commit d496984

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

exercises/practice/transpose/.docs/instructions.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ BE
1717
CF
1818
```
1919

20-
Rows become columns and columns become rows. See <https://en.wikipedia.org/wiki/Transpose>.
20+
Rows become columns and columns become rows.
21+
See [transpose][].
2122

2223
If the input has rows of different lengths, this is to be solved as follows:
2324

@@ -55,5 +56,6 @@ BE
5556
```
5657

5758
In general, all characters from the input should also be present in the transposed output.
58-
That means that if a column in the input text contains only spaces on its bottom-most row(s),
59-
the corresponding output row should contain the spaces in its right-most column(s).
59+
That means that if a column in the input text contains only spaces on its bottom-most row(s), the corresponding output row should contain the spaces in its right-most column(s).
60+
61+
[transpose]: https://en.wikipedia.org/wiki/Transpose

exercises/practice/transpose/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ description = "rectangle"
4141

4242
[b80badc9-057e-4543-bd07-ce1296a1ea2c]
4343
description = "triangle"
44+
45+
[76acfd50-5596-4d05-89f1-5116328a7dd9]
46+
description = "jagged triangle"

exercises/practice/transpose/transpose_test.rb

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,84 @@ class TransposeTest < Minitest::Test
55
def test_empty_string
66
# skip
77
input = ""
8-
98
expected = ""
10-
119
assert_equal expected, Transpose.transpose(input)
1210
end
1311

1412
def test_two_characters_in_a_row
1513
skip
1614
input = "A1"
17-
1815
expected = "A\n1"
19-
2016
assert_equal expected, Transpose.transpose(input)
2117
end
2218

2319
def test_two_characters_in_a_column
2420
skip
2521
input = "A\n1"
26-
2722
expected = "A1"
28-
2923
assert_equal expected, Transpose.transpose(input)
3024
end
3125

3226
def test_simple
3327
skip
3428
input = "ABC\n123"
35-
3629
expected = "A1\nB2\nC3"
37-
3830
assert_equal expected, Transpose.transpose(input)
3931
end
4032

4133
def test_single_line
4234
skip
4335
input = "Single line."
44-
4536
expected = "S\ni\nn\ng\nl\ne\n \nl\ni\nn\ne\n."
46-
4737
assert_equal expected, Transpose.transpose(input)
4838
end
4939

5040
def test_first_line_longer_than_second_line
5141
skip
5242
input = "The fourth line.\nThe fifth line."
53-
5443
expected = "TT\nhh\nee\n \nff\noi\nuf\nrt\nth\nh \n l\nli\nin\nne\ne.\n."
55-
5644
assert_equal expected, Transpose.transpose(input)
5745
end
5846

5947
def test_second_line_longer_than_first_line
6048
skip
6149
input = "The first line.\nThe second line."
62-
6350
expected = "TT\nhh\nee\n \nfs\nie\nrc\nso\ntn\n d\nl \nil\nni\nen\n.e\n ."
64-
6551
assert_equal expected, Transpose.transpose(input)
6652
end
6753

6854
def test_mixed_line_length
6955
skip
7056
input = "The longest line.\nA long line.\nA longer line.\nA line."
71-
7257
expected = "TAAA\nh \nelll\n ooi\nlnnn\nogge\nn e.\nglr\nei \nsnl\ntei\n .n\nl e\ni .\nn\ne\n."
73-
7458
assert_equal expected, Transpose.transpose(input)
7559
end
7660

7761
def test_square
7862
skip
7963
input = "HEART\nEMBER\nABUSE\nRESIN\nTREND"
80-
8164
expected = "HEART\nEMBER\nABUSE\nRESIN\nTREND"
82-
8365
assert_equal expected, Transpose.transpose(input)
8466
end
8567

8668
def test_rectangle
8769
skip
8870
input = "FRACTURE\nOUTLINED\nBLOOMING\nSEPTETTE"
89-
9071
expected = "FOBS\nRULE\nATOP\nCLOT\nTIME\nUNIT\nRENT\nEDGE"
91-
9272
assert_equal expected, Transpose.transpose(input)
9373
end
9474

9575
def test_triangle
9676
skip
9777
input = "T\nEE\nAAA\nSSSS\nEEEEE\nRRRRRR"
98-
9978
expected = "TEASER\n EASER\n ASER\n SER\n ER\n R"
79+
assert_equal expected, Transpose.transpose(input)
80+
end
10081

82+
def test_jagged_triangle
83+
skip
84+
input = "11\n2\n3333\n444\n555555\n66666"
85+
expected = "123456\n1 3456\n 3456\n 3 56\n 56\n 5"
10186
assert_equal expected, Transpose.transpose(input)
10287
end
10388
end

0 commit comments

Comments
 (0)