summaryrefslogtreecommitdiff
path: root/go/acronym/acronym_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-11-11 01:13:51 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-11-11 01:13:51 +0100
commitd8f2fbf5a82505b5d33e5d8a37fabafd19244aa7 (patch)
tree4451cff925dc276501a9d2b3acd9a44c47421cab /go/acronym/acronym_test.go
parentebf043f8d0336af76ce2514bee66dad1ce58658d (diff)
Solve acronym
Diffstat (limited to 'go/acronym/acronym_test.go')
-rw-r--r--go/acronym/acronym_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/go/acronym/acronym_test.go b/go/acronym/acronym_test.go
new file mode 100644
index 0000000..d68fcd6
--- /dev/null
+++ b/go/acronym/acronym_test.go
@@ -0,0 +1,36 @@
+package acronym
+
+import (
+ "testing"
+)
+
+const targetTestVersion = 1
+
+type testCase struct {
+ input string
+ expected string
+}
+
+var stringTestCases = []testCase{
+ {"Portable Network Graphics", "PNG"},
+ {"HyperText Markup Language", "HTML"},
+ {"Ruby on Rails", "ROR"},
+ {"PHP: Hypertext Preprocessor", "PHP"},
+ {"First In, First Out", "FIFO"},
+ {"Complementary metal-oxide semiconductor", "CMOS"},
+}
+
+func TestTestVersion(t *testing.T) {
+ if testVersion != targetTestVersion {
+ t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
+ }
+}
+
+func TestAcronym(t *testing.T) {
+ for _, test := range stringTestCases {
+ actual := abbreviate(test.input)
+ if actual != test.expected {
+ t.Errorf("Acronym test [%s], expected [%s], actual [%s]", test.input, test.expected, actual)
+ }
+ }
+}