-
Notifications
You must be signed in to change notification settings - Fork 0
/
syllables_test.go
56 lines (52 loc) · 1.26 KB
/
syllables_test.go
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
package dajareGo
import (
"testing"
)
func TestSyllablesNew(t *testing.T) {
// case 1
// 布団が吹っ飛んだ
wont := Syllables{
"hu",
"ton",
"ga",
"hut",
"ton",
"da",
}
got := NewSyllables("フトンガフットンダ")
if !wont.equals(got) {
t.Error("failed: expects", wont, "but output was", got)
}
// case 2
// チャットツールの導入
wont = Syllables{
"tiyt",
"to",
"tu-",
"ru",
"no",
"do-",
"niy-",
}
got = NewSyllables("チャットツールノドーニュウ。")
if !wont.equals(got) {
t.Error("failed: expects", wont, "but output was", got)
}
}
func TestSyllablesEquals(t *testing.T) {
syllable1 := NewSyllables("イカ")
syllable2 := NewSyllables("タコ")
if syllable1.equals(syllable2) {
t.Error("failed: イカ/タコ expects", false, "but output was", true)
}
syllable1 = NewSyllables("ジャガイモ")
syllable2 = NewSyllables("トマト")
if syllable1.equals(syllable2) {
t.Error("failed: ジャガイモ/トマト expects", false, "but output was", true)
}
syllable1 = NewSyllables("ダンシャクイモ")
syllable2 = NewSyllables("ダンシャクイモ")
if !syllable1.equals(syllable2) {
t.Error("failed: ダンシャクイモ/ダンシャクイモ expects", true, "but output was", false)
}
}