From d40949d4cfc17d784980f3bbc5da71b339539f48 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 28 Aug 2016 01:47:28 +0200 Subject: Solve wc --- go/word-count/cases_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 go/word-count/cases_test.go (limited to 'go/word-count/cases_test.go') diff --git a/go/word-count/cases_test.go b/go/word-count/cases_test.go new file mode 100644 index 0000000..204e122 --- /dev/null +++ b/go/word-count/cases_test.go @@ -0,0 +1,41 @@ +package wordcount + +// Source: exercism/x-common +// Commit: 3b07e53 Merge pull request #117 from mikeyjcat/add-raindrops-json + +var testCases = []struct { + description string + input string + output Frequency +}{ + { + "count one word", + "word", + Frequency{"word": 1}, + }, + { + "count one of each word", + "one of each", + Frequency{"each": 1, "of": 1, "one": 1}, + }, + { + "multiple occurrences of a word", + "one fish two fish red fish blue fish", + Frequency{"blue": 1, "fish": 4, "one": 1, "red": 1, "two": 1}, + }, + { + "ignore punctuation", + "car : carpet as java : javascript!!&@$%^&", + Frequency{"as": 1, "car": 1, "carpet": 1, "java": 1, "javascript": 1}, + }, + { + "include numbers", + "testing, 1, 2 testing", + Frequency{"1": 1, "2": 1, "testing": 2}, + }, + { + "normalize case", + "go Go GO", + Frequency{"go": 3}, + }, +} -- cgit v1.2.3