1
exercism fetch scala pig-latin

src/test/scala/PigLatinTest.scala

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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import org.scalatest.{Matchers, FunSuite}

/** @version 1.1.0 */
class PigLatinTest extends FunSuite with Matchers {

  test("word beginning with a") {
    PigLatin.translate("apple") should be ("appleay")
  }

  test("word beginning with e") {
    pending
    PigLatin.translate("ear") should be ("earay")
  }

  test("word beginning with i") {
    pending
    PigLatin.translate("igloo") should be ("iglooay")
  }

  test("word beginning with o") {
    pending
    PigLatin.translate("object") should be ("objectay")
  }

  test("word beginning with u") {
    pending
    PigLatin.translate("under") should be ("underay")
  }

  test("word beginning with a vowel and followed by a qu") {
    pending
    PigLatin.translate("equal") should be ("equalay")
  }

  test("word beginning with p") {
    pending
    PigLatin.translate("pig") should be ("igpay")
  }

  test("word beginning with k") {
    pending
    PigLatin.translate("koala") should be ("oalakay")
  }

  test("word beginning with x") {
    pending
    PigLatin.translate("xenon") should be ("enonxay")
  }

  test("word beginning with q without a following u") {
    pending
    PigLatin.translate("qat") should be ("atqay")
  }

  test("word beginning with ch") {
    pending
    PigLatin.translate("chair") should be ("airchay")
  }

  test("word beginning with qu") {
    pending
    PigLatin.translate("queen") should be ("eenquay")
  }

  test("word beginning with qu and a preceding consonant") {
    pending
    PigLatin.translate("square") should be ("aresquay")
  }

  test("word beginning with th") {
    pending
    PigLatin.translate("therapy") should be ("erapythay")
  }

  test("word beginning with thr") {
    pending
    PigLatin.translate("thrush") should be ("ushthray")
  }

  test("word beginning with sch") {
    pending
    PigLatin.translate("school") should be ("oolschay")
  }

  test("word beginning with yt") {
    pending
    PigLatin.translate("yttria") should be ("yttriaay")
  }

  test("word beginning with xr") {
    pending
    PigLatin.translate("xray") should be ("xrayay")
  }

  test("y is treated like a consonant at the beginning of a word") {
    pending
    PigLatin.translate("yellow") should be ("ellowyay")
  }

  test("y is treated like a vowel at the end of a consonant cluster") {
    pending
    PigLatin.translate("rhythm") should be ("ythmrhay")
  }

  test("y as second letter in two letter word") {
    pending
    PigLatin.translate("my") should be ("ymay")
  }

  test("a whole phrase") {
    pending
    PigLatin.translate("quick fast run") should be ("ickquay astfay unray")
  }
}