-
Notifications
You must be signed in to change notification settings - Fork 0
/
happy_monday_test.go
100 lines (94 loc) · 3.85 KB
/
happy_monday_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
92
93
94
95
96
97
98
99
100
package flagday_test
import (
"testing"
"github.com/pinzolo/flagday"
)
func TestHappyMondayBefore(t *testing.T) {
testdata := []expected{
{1, 1, "元日", flagday.PublicHoliday},
{1, 15, "成人の日", flagday.PublicHoliday},
{2, 11, "建国記念の日", flagday.PublicHoliday},
{3, 21, "春分の日", flagday.PublicHoliday},
{3, 22, "振替休日", flagday.SubstituteHoliday},
{4, 29, "みどりの日", flagday.PublicHoliday},
{5, 3, "憲法記念日", flagday.PublicHoliday},
{5, 4, "国民の休日", flagday.NationalHoliday},
{5, 5, "こどもの日", flagday.PublicHoliday},
{7, 20, "海の日", flagday.PublicHoliday},
{9, 15, "敬老の日", flagday.PublicHoliday},
{9, 23, "秋分の日", flagday.PublicHoliday},
{10, 10, "体育の日", flagday.PublicHoliday},
{10, 11, "振替休日", flagday.SubstituteHoliday},
{11, 3, "文化の日", flagday.PublicHoliday},
{11, 23, "勤労感謝の日", flagday.PublicHoliday},
{12, 23, "天皇誕生日", flagday.PublicHoliday},
}
year := 1999
dates := flagday.InYear(year)
testHolidays(t, year, dates, testdata)
}
func TestHappyMonday1st(t *testing.T) {
testdata := []expected{
{1, 1, "元日", flagday.PublicHoliday},
{1, 10, "成人の日", flagday.PublicHoliday}, // changed
{2, 11, "建国記念の日", flagday.PublicHoliday},
{3, 20, "春分の日", flagday.PublicHoliday},
{4, 29, "みどりの日", flagday.PublicHoliday},
{5, 3, "憲法記念日", flagday.PublicHoliday},
{5, 4, "国民の休日", flagday.NationalHoliday},
{5, 5, "こどもの日", flagday.PublicHoliday},
{7, 20, "海の日", flagday.PublicHoliday},
{9, 15, "敬老の日", flagday.PublicHoliday},
{9, 23, "秋分の日", flagday.PublicHoliday},
{10, 9, "体育の日", flagday.PublicHoliday}, // changed
{11, 3, "文化の日", flagday.PublicHoliday},
{11, 23, "勤労感謝の日", flagday.PublicHoliday},
{12, 23, "天皇誕生日", flagday.PublicHoliday},
}
year := 2000
dates := flagday.InYear(year)
testHolidays(t, year, dates, testdata)
}
func TestHappyMonday2nd(t *testing.T) {
testdata := []expected{
{1, 1, "元日", flagday.PublicHoliday},
{1, 13, "成人の日", flagday.PublicHoliday},
{2, 11, "建国記念の日", flagday.PublicHoliday},
{3, 21, "春分の日", flagday.PublicHoliday},
{4, 29, "みどりの日", flagday.PublicHoliday},
{5, 3, "憲法記念日", flagday.PublicHoliday},
{5, 4, "国民の休日", flagday.NationalHoliday},
{5, 5, "こどもの日", flagday.PublicHoliday},
{7, 21, "海の日", flagday.PublicHoliday}, // changed
{9, 15, "敬老の日", flagday.PublicHoliday},
{9, 23, "秋分の日", flagday.PublicHoliday},
{10, 13, "体育の日", flagday.PublicHoliday},
{11, 3, "文化の日", flagday.PublicHoliday},
{11, 23, "勤労感謝の日", flagday.PublicHoliday},
{11, 24, "振替休日", flagday.SubstituteHoliday},
{12, 23, "天皇誕生日", flagday.PublicHoliday},
}
year := 2003
dates := flagday.InYear(year)
testHolidays(t, year, dates, testdata)
testdata = []expected{
{1, 1, "元日", flagday.PublicHoliday},
{1, 12, "成人の日", flagday.PublicHoliday},
{2, 11, "建国記念の日", flagday.PublicHoliday},
{3, 20, "春分の日", flagday.PublicHoliday},
{4, 29, "みどりの日", flagday.PublicHoliday},
{5, 3, "憲法記念日", flagday.PublicHoliday},
{5, 4, "国民の休日", flagday.NationalHoliday},
{5, 5, "こどもの日", flagday.PublicHoliday},
{7, 19, "海の日", flagday.PublicHoliday},
{9, 20, "敬老の日", flagday.PublicHoliday}, // changed
{9, 23, "秋分の日", flagday.PublicHoliday},
{10, 11, "体育の日", flagday.PublicHoliday},
{11, 3, "文化の日", flagday.PublicHoliday},
{11, 23, "勤労感謝の日", flagday.PublicHoliday},
{12, 23, "天皇誕生日", flagday.PublicHoliday},
}
year = 2004
dates = flagday.InYear(year)
testHolidays(t, year, dates, testdata)
}