forked from greymd/ojichat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator_test.go
91 lines (81 loc) · 2.68 KB
/
generator_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
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
package generator
import "testing"
func TestStart1(t *testing.T) {
config := Config{}
actual, err := Start(config)
t.Log(actual)
if err != nil {
t.Errorf("handler returned unexpected body: got %v", err)
}
}
func TestStart2(t *testing.T) {
config := Config{
PunctuationLevel: 4,
}
_, err := Start(config)
t.Log(err)
if err == nil {
t.Errorf("handler returned unexpected body: got nil")
}
}
func TestKatakanaKatsuyou1(t *testing.T) {
expected := "なんちゃッテ"
actual := katakanaKatsuyou("なんちゃって", 2)
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func TestKatakanaKatsuyou2(t *testing.T) {
expected := "どうしちゃったノカナ{EMOJI_POS}"
actual := katakanaKatsuyou("どうしちゃったのかな{EMOJI_POS}", 3)
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func TestKatakanaKatsuyou3(t *testing.T) {
expected := "どうしちゃったのかな{EMOJI_POS}"
actual := katakanaKatsuyou("どうしちゃったのかな{EMOJI_POS}", 0)
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func TestKatakanaKatsuyou4(t *testing.T) {
expected := "東西南北{EMOJI_POS}"
actual := katakanaKatsuyou("東西南北{EMOJI_POS}", 2)
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func TestInsertPunctuations0(t *testing.T) {
expected := "どうしちゃったのかな"
actual := insertPunctuations("どうしちゃったのかな", PunctuationConfig{[]string{"助動詞", "名詞"}, 0})
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func TestInsertPunctuations2(t *testing.T) {
expected := "どうしちゃった、のかな"
actual := insertPunctuations("どうしちゃったのかな", PunctuationConfig{[]string{"助動詞"}, 100})
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func TestInsertPunctuations3(t *testing.T) {
expected := "どうしちゃった、のか、な、"
actual := insertPunctuations("どうしちゃったのかな", PunctuationConfig{[]string{"助動詞", "助詞"}, 100})
t.Log(actual)
if actual != expected {
t.Errorf("handler returned unexpected body: got %v want %v", actual, expected)
}
}
func BenchmarkPunctuation(b *testing.B) {
for i:=0; i < b.N; i++ {
insertPunctuations("どうしちゃったのかな", PunctuationConfig{[]string{"助動詞", "助詞"}, 100})
}
}