-
Notifications
You must be signed in to change notification settings - Fork 3
/
zodiac_test.go
52 lines (41 loc) · 1.35 KB
/
zodiac_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
package gozodiac
import (
"log"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
const shortForm = "2006-Jan-02"
func TestGetZodiacSign(t *testing.T) {
// sign := GetZodiacSign(time.Now())
// log.Printf("sign: %v", sign)
testTime, err := time.Parse(shortForm, "2013-Feb-03")
assert.NoError(t, err)
sign := GetZodiacSign(testTime)
assert.Equal(t, []ZodiacSign{Aquarius}, sign)
testTime, err = time.Parse(shortForm, "2001-Nov-15")
assert.NoError(t, err)
sign = GetZodiacSign(testTime)
assert.Equal(t, []ZodiacSign{Scorpio}, sign)
testTime, err = time.Parse(shortForm, "1942-Oct-11")
assert.NoError(t, err)
sign = GetZodiacSign(testTime)
assert.Equal(t, []ZodiacSign{Libra}, sign)
}
func TestGetChineseZodiacSign(t *testing.T) {
// sign := GetZodiacSign(time.Now())
// log.Printf("sign: %v", sign)
testTime, err := time.Parse(shortForm, "1963-Dec-18")
assert.NoError(t, err)
sign := GetChineseZodiacSign(testTime)
log.Println("chinese zodiac sign:", sign)
// assert.Equal(t, []ZodiacSign{Aquarius}, sign)
// testTime, err = time.Parse(shortForm, "2001-Nov-15")
// assert.NoError(t, err)
// sign = GetZodiacSign(testTime)
// assert.Equal(t, []ZodiacSign{Scorpio}, sign)
// testTime, err = time.Parse(shortForm, "1942-Oct-11")
// assert.NoError(t, err)
// sign = GetZodiacSign(testTime)
// assert.Equal(t, []ZodiacSign{Libra}, sign)
}