-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathPigLatinTranslatorTest.java
More file actions
77 lines (57 loc) · 2.01 KB
/
PigLatinTranslatorTest.java
File metadata and controls
77 lines (57 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class PigLatinTranslatorTest {
private String englishPhrase;
private String pigLatinTranslation;
@Parameterized.Parameters(name = "{index}: expected \"{0}\" to translate to the pig latin phrase \"{1}\"")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
// Ay is added to words that start with vowels
{"apple", "appleay"},
{"ear", "earay"},
{"igloo", "iglooay"},
{"object", "objectay"},
{"under", "underay"},
// First letter and ay are moved to the end of words that start with consonants
{"pig", "igpay"},
{"koala", "oalakay"},
{"yellow", "ellowyay"},
{"xenon", "enonxay"},
// Ch is treated like a single consonant
{"chair", "airchay"},
// Qu is treated like a single consonant
{"queen", "eenquay"},
// Qu and a single preceding consonant are treated like a single consonant
{"square", "aresquay"},
// Th is treated like a single consonant
{"therapy", "erapythay"},
// Thr is treated like a single consonant
{"thrush", "ushthray"},
// Sch is treated like a single consonant
{"school", "oolschay"},
// Yt is treated like a single vowel
{"yttria", "yttriaay"},
// Xr is treated like a single vowel
{"xray", "xrayay"},
{"rhythm", "ythmrhay"},
{"my", "ymay"},
// Phrases are translated
{"quick fast run", "ickquay astfay unray"}
});
}
public PigLatinTranslatorTest(String englishPhrase, String pigLatinTranslation) {
this.englishPhrase = englishPhrase;
this.pigLatinTranslation = pigLatinTranslation;
}
@Ignore
@Test
public void test() {
assertEquals(pigLatinTranslation, new PigLatinTranslator().translate(englishPhrase));
}
}