summaryrefslogtreecommitdiff
path: root/go/pig-latin/pig_latin_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/pig-latin/pig_latin_test.go')
-rw-r--r--go/pig-latin/pig_latin_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/go/pig-latin/pig_latin_test.go b/go/pig-latin/pig_latin_test.go
new file mode 100644
index 0000000..a8397a6
--- /dev/null
+++ b/go/pig-latin/pig_latin_test.go
@@ -0,0 +1,29 @@
+package igpay
+
+import "testing"
+
+var tests = []struct{ pl, in string }{
+ {"appleay", "apple"},
+ {"earay", "ear"},
+ {"igpay", "pig"},
+ {"oalakay", "koala"},
+ {"airchay", "chair"},
+ {"eenquay", "queen"},
+ {"aresquay", "square"},
+ {"erapythay", "therapy"},
+ {"ushthray", "thrush"},
+ {"oolschay", "school"},
+ {"ickquay astfay unray", "quick fast run"},
+ {"ellowyay", "yellow"},
+ {"yttriaay", "yttria"},
+ {"enonxay", "xenon"},
+ {"xrayay", "xray"},
+}
+
+func TestPigLatin(t *testing.T) {
+ for _, test := range tests {
+ if pl := PigLatin(test.in); pl != test.pl {
+ t.Fatalf("PigLatin(%q) = %q, want %q.", test.in, pl, test.pl)
+ }
+ }
+}