-
Notifications
You must be signed in to change notification settings - Fork 0
/
jwaven_test.go
59 lines (44 loc) · 1.05 KB
/
jwaven_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
package jwaven
import (
"testing"
"time"
)
func TestGetYear(t *testing.T) {
jwaven := newJwaven(t)
if jwaven.GetYear() != 2006 {
t.Errorf("jwaven.GetYear() is not 2006, but %v", jwaven.GetYear())
}
}
func TestGetMonth(t *testing.T) {
jwaven := newJwaven(t)
if jwaven.GetMonth() != 1 {
t.Errorf("jwaven.GetMonth() is not 1, but %v", jwaven.GetMonth())
}
}
func TestGetDay(t *testing.T) {
jwaven := newJwaven(t)
if jwaven.GetDay() != 2 {
t.Errorf("jwaven.GetDay() is not 2, but %v", jwaven.GetDay())
}
}
func TestGetHour(t *testing.T) {
jwaven := newJwaven(t)
if jwaven.GetHour() != 15 {
t.Errorf("jwaven.GetHour() is not 15, but %v", jwaven.GetHour())
}
}
func TestGetMinute(t *testing.T) {
jwaven := newJwaven(t)
if jwaven.GetMinute() != 4 {
t.Errorf("jwaven.GetMinute() is not 4, but %v", jwaven.GetMinute())
}
}
func newJwaven(t *testing.T) *Jwaven {
jwaven := NewJwaven()
time, err := time.Parse("2006-01-02 15:04", "2006-01-02 15:04")
if err != nil {
t.Fatal("time parse error.")
}
jwaven.SearchTime = time
return jwaven
}