|
|
@@ -15,6 +15,7 @@ public class TransposeTest {
|
|
15
|
15
|
@Test
|
|
16
|
16
|
public void emptyString() {
|
|
17
|
17
|
String input = "";
|
|
|
18
|
+
|
|
18
|
19
|
String expected = "";
|
|
19
|
20
|
|
|
20
|
21
|
assertEquals(expected, transpose.transpose(input));
|
|
|
@@ -24,8 +25,9 @@ public class TransposeTest {
|
|
24
|
25
|
@Ignore("Remove to run test")
|
|
25
|
26
|
public void twoCharsInARow() {
|
|
26
|
27
|
String input = "A1";
|
|
|
28
|
+
|
|
27
|
29
|
String expected = "A" +
|
|
28
|
|
- "\n1";
|
|
|
30
|
+ "\n1";
|
|
29
|
31
|
|
|
30
|
32
|
assertEquals(expected, transpose.transpose(input));
|
|
31
|
33
|
}
|
|
|
@@ -34,7 +36,8 @@ public class TransposeTest {
|
|
34
|
36
|
@Ignore("Remove to run test")
|
|
35
|
37
|
public void twoCharsInAColumn() {
|
|
36
|
38
|
String input = "A\n" +
|
|
37
|
|
- "1";
|
|
|
39
|
+ "1";
|
|
|
40
|
+
|
|
38
|
41
|
String expected = "A1";
|
|
39
|
42
|
|
|
40
|
43
|
assertEquals(expected, transpose.transpose(input));
|
|
|
@@ -42,12 +45,13 @@ public class TransposeTest {
|
|
42
|
45
|
|
|
43
|
46
|
@Test
|
|
44
|
47
|
@Ignore("Remove to run test")
|
|
45
|
|
- public void simple() {
|
|
|
48
|
+ public void simpleMatrix() {
|
|
46
|
49
|
String input = "ABC\n" +
|
|
47
|
|
- "123";
|
|
|
50
|
+ "123";
|
|
|
51
|
+
|
|
48
|
52
|
String expected = "A1\n" +
|
|
49
|
|
- "B2\n" +
|
|
50
|
|
- "C3";
|
|
|
53
|
+ "B2\n" +
|
|
|
54
|
+ "C3";
|
|
51
|
55
|
|
|
52
|
56
|
assertEquals(expected, transpose.transpose(input));
|
|
53
|
57
|
}
|
|
|
@@ -56,18 +60,19 @@ public class TransposeTest {
|
|
56
|
60
|
@Ignore("Remove to run test")
|
|
57
|
61
|
public void singleLine() {
|
|
58
|
62
|
String input = "Single line.";
|
|
|
63
|
+
|
|
59
|
64
|
String expected = "S\n" +
|
|
60
|
|
- "i\n" +
|
|
61
|
|
- "n\n" +
|
|
62
|
|
- "g\n" +
|
|
63
|
|
- "l\n" +
|
|
64
|
|
- "e\n" +
|
|
65
|
|
- " \n" +
|
|
66
|
|
- "l\n" +
|
|
67
|
|
- "i\n" +
|
|
68
|
|
- "n\n" +
|
|
69
|
|
- "e\n" +
|
|
70
|
|
- ".";
|
|
|
65
|
+ "i\n" +
|
|
|
66
|
+ "n\n" +
|
|
|
67
|
+ "g\n" +
|
|
|
68
|
+ "l\n" +
|
|
|
69
|
+ "e\n" +
|
|
|
70
|
+ " \n" +
|
|
|
71
|
+ "l\n" +
|
|
|
72
|
+ "i\n" +
|
|
|
73
|
+ "n\n" +
|
|
|
74
|
+ "e\n" +
|
|
|
75
|
+ ".";
|
|
71
|
76
|
|
|
72
|
77
|
assertEquals(expected, transpose.transpose(input));
|
|
73
|
78
|
}
|
|
|
@@ -76,23 +81,24 @@ public class TransposeTest {
|
|
76
|
81
|
@Ignore("Remove to run test")
|
|
77
|
82
|
public void firstLineLongerThanSecond() {
|
|
78
|
83
|
String input = "The fourth line.\n" +
|
|
79
|
|
- "The fifth line.";
|
|
|
84
|
+ "The fifth line.";
|
|
|
85
|
+
|
|
80
|
86
|
String expected = "TT\n" +
|
|
81
|
|
- "hh\n" +
|
|
82
|
|
- "ee\n" +
|
|
83
|
|
- " \n" +
|
|
84
|
|
- "ff\n" +
|
|
85
|
|
- "oi\n" +
|
|
86
|
|
- "uf\n" +
|
|
87
|
|
- "rt\n" +
|
|
88
|
|
- "th\n" +
|
|
89
|
|
- "h \n" +
|
|
90
|
|
- " l\n" +
|
|
91
|
|
- "li\n" +
|
|
92
|
|
- "in\n" +
|
|
93
|
|
- "ne\n" +
|
|
94
|
|
- "e.\n" +
|
|
95
|
|
- ".";
|
|
|
87
|
+ "hh\n" +
|
|
|
88
|
+ "ee\n" +
|
|
|
89
|
+ " \n" +
|
|
|
90
|
+ "ff\n" +
|
|
|
91
|
+ "oi\n" +
|
|
|
92
|
+ "uf\n" +
|
|
|
93
|
+ "rt\n" +
|
|
|
94
|
+ "th\n" +
|
|
|
95
|
+ "h \n" +
|
|
|
96
|
+ " l\n" +
|
|
|
97
|
+ "li\n" +
|
|
|
98
|
+ "in\n" +
|
|
|
99
|
+ "ne\n" +
|
|
|
100
|
+ "e.\n" +
|
|
|
101
|
+ ".";
|
|
96
|
102
|
|
|
97
|
103
|
assertEquals(expected, transpose.transpose(input));
|
|
98
|
104
|
}
|
|
|
@@ -101,24 +107,24 @@ public class TransposeTest {
|
|
101
|
107
|
@Ignore("Remove to run test")
|
|
102
|
108
|
public void secondLineLongerThanFirst() {
|
|
103
|
109
|
String input = "The first line.\n" +
|
|
104
|
|
- "The second line.";
|
|
|
110
|
+ "The second line.";
|
|
105
|
111
|
|
|
106
|
112
|
String expected = "TT\n" +
|
|
107
|
|
- "hh\n" +
|
|
108
|
|
- "ee\n" +
|
|
109
|
|
- " \n" +
|
|
110
|
|
- "fs\n" +
|
|
111
|
|
- "ie\n" +
|
|
112
|
|
- "rc\n" +
|
|
113
|
|
- "so\n" +
|
|
114
|
|
- "tn\n" +
|
|
115
|
|
- " d\n" +
|
|
116
|
|
- "l \n" +
|
|
117
|
|
- "il\n" +
|
|
118
|
|
- "ni\n" +
|
|
119
|
|
- "en\n" +
|
|
120
|
|
- ".e\n" +
|
|
121
|
|
- " .";
|
|
|
113
|
+ "hh\n" +
|
|
|
114
|
+ "ee\n" +
|
|
|
115
|
+ " \n" +
|
|
|
116
|
+ "fs\n" +
|
|
|
117
|
+ "ie\n" +
|
|
|
118
|
+ "rc\n" +
|
|
|
119
|
+ "so\n" +
|
|
|
120
|
+ "tn\n" +
|
|
|
121
|
+ " d\n" +
|
|
|
122
|
+ "l \n" +
|
|
|
123
|
+ "il\n" +
|
|
|
124
|
+ "ni\n" +
|
|
|
125
|
+ "en\n" +
|
|
|
126
|
+ ".e\n" +
|
|
|
127
|
+ " .";
|
|
122
|
128
|
|
|
123
|
129
|
assertEquals(expected, transpose.transpose(input));
|
|
124
|
130
|
}
|
|
|
@@ -127,16 +133,16 @@ public class TransposeTest {
|
|
127
|
133
|
@Ignore("Remove to run test")
|
|
128
|
134
|
public void square() {
|
|
129
|
135
|
String input = "HEART\n" +
|
|
130
|
|
- "EMBER\n" +
|
|
131
|
|
- "ABUSE\n" +
|
|
132
|
|
- "RESIN\n" +
|
|
133
|
|
- "TREND";
|
|
|
136
|
+ "EMBER\n" +
|
|
|
137
|
+ "ABUSE\n" +
|
|
|
138
|
+ "RESIN\n" +
|
|
|
139
|
+ "TREND";
|
|
134
|
140
|
|
|
135
|
141
|
String expected = "HEART\n" +
|
|
136
|
|
- "EMBER\n" +
|
|
137
|
|
- "ABUSE\n" +
|
|
138
|
|
- "RESIN\n" +
|
|
139
|
|
- "TREND";
|
|
|
142
|
+ "EMBER\n" +
|
|
|
143
|
+ "ABUSE\n" +
|
|
|
144
|
+ "RESIN\n" +
|
|
|
145
|
+ "TREND";
|
|
140
|
146
|
|
|
141
|
147
|
assertEquals(expected, transpose.transpose(input));
|
|
142
|
148
|
}
|
|
|
@@ -145,18 +151,18 @@ public class TransposeTest {
|
|
145
|
151
|
@Ignore("Remove to run test")
|
|
146
|
152
|
public void rectangle() {
|
|
147
|
153
|
String input = "FRACTURE\n" +
|
|
148
|
|
- "OUTLINED\n" +
|
|
149
|
|
- "BLOOMING\n" +
|
|
150
|
|
- "SEPTETTE";
|
|
|
154
|
+ "OUTLINED\n" +
|
|
|
155
|
+ "BLOOMING\n" +
|
|
|
156
|
+ "SEPTETTE";
|
|
151
|
157
|
|
|
152
|
158
|
String expected = "FOBS\n" +
|
|
153
|
|
- "RULE\n" +
|
|
154
|
|
- "ATOP\n" +
|
|
155
|
|
- "CLOT\n" +
|
|
156
|
|
- "TIME\n" +
|
|
157
|
|
- "UNIT\n" +
|
|
158
|
|
- "RENT\n" +
|
|
159
|
|
- "EDGE";
|
|
|
159
|
+ "RULE\n" +
|
|
|
160
|
+ "ATOP\n" +
|
|
|
161
|
+ "CLOT\n" +
|
|
|
162
|
+ "TIME\n" +
|
|
|
163
|
+ "UNIT\n" +
|
|
|
164
|
+ "RENT\n" +
|
|
|
165
|
+ "EDGE";
|
|
160
|
166
|
|
|
161
|
167
|
assertEquals(expected, transpose.transpose(input));
|
|
162
|
168
|
}
|
|
|
@@ -164,19 +170,19 @@ public class TransposeTest {
|
|
164
|
170
|
@Test
|
|
165
|
171
|
@Ignore("Remove to run test")
|
|
166
|
172
|
public void triangle() {
|
|
167
|
|
- String input = "T\n" +
|
|
168
|
|
- "EE\n" +
|
|
169
|
|
- "AAA\n" +
|
|
170
|
|
- "SSSS\n" +
|
|
171
|
|
- "EEEEE\n" +
|
|
172
|
|
- "RRRRRR";
|
|
|
173
|
+ String input = "T\n" +
|
|
|
174
|
+ "EE\n" +
|
|
|
175
|
+ "AAA\n" +
|
|
|
176
|
+ "SSSS\n" +
|
|
|
177
|
+ "EEEEE\n" +
|
|
|
178
|
+ "RRRRRR";
|
|
173
|
179
|
|
|
174
|
180
|
String expected = "TEASER\n" +
|
|
175
|
|
- " EASER\n" +
|
|
176
|
|
- " ASER\n" +
|
|
177
|
|
- " SER\n" +
|
|
178
|
|
- " ER\n" +
|
|
179
|
|
- " R";
|
|
|
181
|
+ " EASER\n" +
|
|
|
182
|
+ " ASER\n" +
|
|
|
183
|
+ " SER\n" +
|
|
|
184
|
+ " ER\n" +
|
|
|
185
|
+ " R";
|
|
180
|
186
|
|
|
181
|
187
|
assertEquals(expected, transpose.transpose(input));
|
|
182
|
188
|
}
|
|
|
@@ -184,75 +190,74 @@ public class TransposeTest {
|
|
184
|
190
|
@Test
|
|
185
|
191
|
@Ignore("Remove to run test")
|
|
186
|
192
|
public void manyLines() {
|
|
187
|
|
- String input = "Chor. Two households, both alike in dignity,\n" +
|
|
188
|
|
- "In fair Verona, where we lay our scene,\n" +
|
|
189
|
|
- "From ancient grudge break to new mutiny,\n" +
|
|
190
|
|
- "Where civil blood makes civil hands unclean.\n" +
|
|
191
|
|
- "From forth the fatal loins of these two foes\n" +
|
|
192
|
|
- "A pair of star-cross'd lovers take their life;\n" +
|
|
193
|
|
- "Whose misadventur'd piteous overthrows\n" +
|
|
194
|
|
- "Doth with their death bury their parents' strife.\n" +
|
|
195
|
|
- "The fearful passage of their death-mark'd love,\n" +
|
|
196
|
|
- "And the continuance of their parents' rage,\n" +
|
|
197
|
|
- "Which, but their children's end, naught could remove,\n" +
|
|
198
|
|
- "Is now the two hours' traffic of our stage;\n" +
|
|
199
|
|
- "The which if you with patient ears attend,\n" +
|
|
200
|
|
- "What here shall miss, our toil shall strive to mend.";
|
|
201
|
|
-
|
|
|
193
|
+ String input = "Chor. Two households, both alike in dignity,\n" +
|
|
|
194
|
+ "In fair Verona, where we lay our scene,\n" +
|
|
|
195
|
+ "From ancient grudge break to new mutiny,\n" +
|
|
|
196
|
+ "Where civil blood makes civil hands unclean.\n" +
|
|
|
197
|
+ "From forth the fatal loins of these two foes\n" +
|
|
|
198
|
+ "A pair of star-cross'd lovers take their life;\n" +
|
|
|
199
|
+ "Whose misadventur'd piteous overthrows\n" +
|
|
|
200
|
+ "Doth with their death bury their parents' strife.\n" +
|
|
|
201
|
+ "The fearful passage of their death-mark'd love,\n" +
|
|
|
202
|
+ "And the continuance of their parents' rage,\n" +
|
|
|
203
|
+ "Which, but their children's end, naught could remove,\n" +
|
|
|
204
|
+ "Is now the two hours' traffic of our stage;\n" +
|
|
|
205
|
+ "The which if you with patient ears attend,\n" +
|
|
|
206
|
+ "What here shall miss, our toil shall strive to mend.";
|
|
202
|
207
|
|
|
203
|
208
|
String expected = "CIFWFAWDTAWITW\n" +
|
|
204
|
|
- "hnrhr hohnhshh\n" +
|
|
205
|
|
- "o oeopotedi ea\n" +
|
|
206
|
|
- "rfmrmash cn t\n" +
|
|
207
|
|
- ".a e ie fthow \n" +
|
|
208
|
|
- " ia fr weh,whh\n" +
|
|
209
|
|
- "Trnco miae ie\n" +
|
|
210
|
|
- "w ciroitr btcr\n" +
|
|
211
|
|
- "oVivtfshfcuhhe\n" +
|
|
212
|
|
- " eeih a uote \n" +
|
|
213
|
|
- "hrnl sdtln is\n" +
|
|
214
|
|
- "oot ttvh tttfh\n" +
|
|
215
|
|
- "un bhaeepihw a\n" +
|
|
216
|
|
- "saglernianeoyl\n" +
|
|
217
|
|
- "e,ro -trsui ol\n" +
|
|
218
|
|
- "h uofcu sarhu \n" +
|
|
219
|
|
- "owddarrdan o m\n" +
|
|
220
|
|
- "lhg to'egccuwi\n" +
|
|
221
|
|
- "deemasdaeehris\n" +
|
|
222
|
|
- "sr als t ists\n" +
|
|
223
|
|
- ",ebk 'phool'h,\n" +
|
|
224
|
|
- " reldi ffd \n" +
|
|
225
|
|
- "bweso tb rtpo\n" +
|
|
226
|
|
- "oea ileutterau\n" +
|
|
227
|
|
- "t kcnoorhhnatr\n" +
|
|
228
|
|
- "hl isvuyee'fi \n" +
|
|
229
|
|
- " atv es iisfet\n" +
|
|
230
|
|
- "ayoior trr ino\n" +
|
|
231
|
|
- "l lfsoh ecti\n" +
|
|
232
|
|
- "ion vedpn l\n" +
|
|
233
|
|
- "kuehtteieadoe \n" +
|
|
234
|
|
- "erwaharrar,fas\n" +
|
|
235
|
|
- " nekt te rh\n" +
|
|
236
|
|
- "ismdsehphnnosa\n" +
|
|
237
|
|
- "ncuse ra-tau l\n" +
|
|
238
|
|
- " et tormsural\n" +
|
|
239
|
|
- "dniuthwea'g t \n" +
|
|
240
|
|
- "iennwesnr hsts\n" +
|
|
241
|
|
- "g,ycoi tkrttet\n" +
|
|
242
|
|
- "n ,l r s'a anr\n" +
|
|
243
|
|
- "i ef 'dgcgdi\n" +
|
|
244
|
|
- "t aol eoe,v\n" +
|
|
245
|
|
- "y nei sl,u; e\n" +
|
|
246
|
|
- ", .sf to l \n" +
|
|
247
|
|
- " e rv d t\n" +
|
|
248
|
|
- " ; ie o\n" +
|
|
249
|
|
- " f, r \n" +
|
|
250
|
|
- " e e m\n" +
|
|
251
|
|
- " . m e\n" +
|
|
252
|
|
- " o n\n" +
|
|
253
|
|
- " v d\n" +
|
|
254
|
|
- " e .\n" +
|
|
255
|
|
- " ,";
|
|
|
209
|
+ "hnrhr hohnhshh\n" +
|
|
|
210
|
+ "o oeopotedi ea\n" +
|
|
|
211
|
+ "rfmrmash cn t\n" +
|
|
|
212
|
+ ".a e ie fthow \n" +
|
|
|
213
|
+ " ia fr weh,whh\n" +
|
|
|
214
|
+ "Trnco miae ie\n" +
|
|
|
215
|
+ "w ciroitr btcr\n" +
|
|
|
216
|
+ "oVivtfshfcuhhe\n" +
|
|
|
217
|
+ " eeih a uote \n" +
|
|
|
218
|
+ "hrnl sdtln is\n" +
|
|
|
219
|
+ "oot ttvh tttfh\n" +
|
|
|
220
|
+ "un bhaeepihw a\n" +
|
|
|
221
|
+ "saglernianeoyl\n" +
|
|
|
222
|
+ "e,ro -trsui ol\n" +
|
|
|
223
|
+ "h uofcu sarhu \n" +
|
|
|
224
|
+ "owddarrdan o m\n" +
|
|
|
225
|
+ "lhg to'egccuwi\n" +
|
|
|
226
|
+ "deemasdaeehris\n" +
|
|
|
227
|
+ "sr als t ists\n" +
|
|
|
228
|
+ ",ebk 'phool'h,\n" +
|
|
|
229
|
+ " reldi ffd \n" +
|
|
|
230
|
+ "bweso tb rtpo\n" +
|
|
|
231
|
+ "oea ileutterau\n" +
|
|
|
232
|
+ "t kcnoorhhnatr\n" +
|
|
|
233
|
+ "hl isvuyee'fi \n" +
|
|
|
234
|
+ " atv es iisfet\n" +
|
|
|
235
|
+ "ayoior trr ino\n" +
|
|
|
236
|
+ "l lfsoh ecti\n" +
|
|
|
237
|
+ "ion vedpn l\n" +
|
|
|
238
|
+ "kuehtteieadoe \n" +
|
|
|
239
|
+ "erwaharrar,fas\n" +
|
|
|
240
|
+ " nekt te rh\n" +
|
|
|
241
|
+ "ismdsehphnnosa\n" +
|
|
|
242
|
+ "ncuse ra-tau l\n" +
|
|
|
243
|
+ " et tormsural\n" +
|
|
|
244
|
+ "dniuthwea'g t \n" +
|
|
|
245
|
+ "iennwesnr hsts\n" +
|
|
|
246
|
+ "g,ycoi tkrttet\n" +
|
|
|
247
|
+ "n ,l r s'a anr\n" +
|
|
|
248
|
+ "i ef 'dgcgdi\n" +
|
|
|
249
|
+ "t aol eoe,v\n" +
|
|
|
250
|
+ "y nei sl,u; e\n" +
|
|
|
251
|
+ ", .sf to l \n" +
|
|
|
252
|
+ " e rv d t\n" +
|
|
|
253
|
+ " ; ie o\n" +
|
|
|
254
|
+ " f, r \n" +
|
|
|
255
|
+ " e e m\n" +
|
|
|
256
|
+ " . m e\n" +
|
|
|
257
|
+ " o n\n" +
|
|
|
258
|
+ " v d\n" +
|
|
|
259
|
+ " e .\n" +
|
|
|
260
|
+ " ,";
|
|
256
|
261
|
|
|
257
|
262
|
assertEquals(expected, transpose.transpose(input));
|
|
258
|
263
|
}
|