This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
prefecture_test.go
82 lines (70 loc) · 1.76 KB
/
prefecture_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
package jp_prefecture
import (
"testing"
)
var prefectureTestData = &prefecture{1, "kanji", "kana", "roma"}
func TestPrefecture_Code(t *testing.T) {
if prefectureTestData.Code() != 1 {
t.Fatal()
}
}
func TestPrefecture_Kanji(t *testing.T) {
if prefectureTestData.Kanji() != "kanji" {
t.Fatal()
}
}
func TestPrefecture_KanjiShort(t *testing.T) {
testData := map[Prefecture]string{
prefectureMap[JISCodeHokkaido]: "北海道",
prefectureMap[JISCodeTokyo]: "東京",
prefectureMap[JISCodeKyoto]: "京都",
prefectureMap[JISCodeOsaka]: "大阪",
prefectureMap[JISCodeOkinawa]: "沖縄",
}
for pref, expect := range testData {
kanji := pref.KanjiShort()
if kanji != expect {
t.Fatal()
}
}
}
func TestPrefecture_Kana(t *testing.T) {
if prefectureTestData.Kana() != "kana" {
t.Fatal()
}
}
func TestPrefecture_KanaShort(t *testing.T) {
testData := map[Prefecture]string{
prefectureMap[JISCodeHokkaido]: "ほっかいどう",
prefectureMap[JISCodeTokyo]: "とうきょう",
prefectureMap[JISCodeKyoto]: "きょうと",
prefectureMap[JISCodeOsaka]: "おおさか",
prefectureMap[JISCodeOkinawa]: "おきなわ",
}
for pref, expect := range testData {
kana := pref.KanaShort()
if kana != expect {
t.Fatal()
}
}
}
func TestPrefecture_Roma(t *testing.T) {
if prefectureTestData.Roma() != "roma" {
t.Fatal()
}
}
func TestPrefecture_RomaShort(t *testing.T) {
testData := map[Prefecture]string{
prefectureMap[JISCodeHokkaido]: "hokkaido",
prefectureMap[JISCodeTokyo]: "tokyo",
prefectureMap[JISCodeKyoto]: "kyoto",
prefectureMap[JISCodeOsaka]: "osaka",
prefectureMap[JISCodeOkinawa]: "okinawa",
}
for pref, expect := range testData {
roma := pref.RomaShort()
if roma != expect {
t.Fatal()
}
}
}