-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdynasty_test.go
76 lines (64 loc) · 1.93 KB
/
dynasty_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
package almanac
import "testing"
func TestNewDynastyInfo(t *testing.T) {
var year = 9999
var d = NewDynastyInfo(year)
var e = Dynasty{1949, 9999, 1948, "当代", "中国", "", "公历纪元"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 1948
d = NewDynastyInfo(year)
e = Dynasty{1912, 37, 0, "近、现代", "中华民国", "", "民国"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 1949
d = NewDynastyInfo(year)
e = Dynasty{1949, 9999, 1948, "当代", "中国", "", "公历纪元"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 1582
d = NewDynastyInfo(year)
e = Dynasty{1573, 48, 0, "明", "神宗", "朱翊钧", "万历"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 888
d = NewDynastyInfo(year)
e = Dynasty{888, 1, 0, "唐", "僖宗", "李儇", "文德"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 777
d = NewDynastyInfo(year)
e = Dynasty{766, 14, 0, "唐", "肃宗", "李亨", "大历"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 60
d = NewDynastyInfo(year)
e = Dynasty{58, 18, 0, "东汉", "明帝", "刘庄", "永平"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = 0
d = NewDynastyInfo(year)
e = Dynasty{-1, 2, 0, "西汉", "哀帝", "刘欣", "元寿"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = -1
d = NewDynastyInfo(year)
e = Dynasty{-1, 2, 0, "西汉", "哀帝", "刘欣", "元寿"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
year = -1000
d = NewDynastyInfo(year)
e = Dynasty{-1019, 25, 0, "西周", "康王", "姬钊", "康王"}
if e != *d {
t.Error("NewDynastyInfo ", year, "Error:", d, ",But Expect:", e)
}
}