-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharacter_test.go
42 lines (35 loc) · 940 Bytes
/
character_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
package nook_test
import (
"reflect"
"testing"
"github.com/lindsaygelle/nook"
)
func testCharacter(t *testing.T, animal nook.Key, c nook.Character) {
if ok := len(c.Key) != 0; !ok {
t.Fatal(c)
}
testCharacterAnimal(t, animal, c)
testCharacterBirthday(t, c)
testCharacterGender(t, c)
testCharacterName(t, c)
}
func testCharacterAnimal(t *testing.T, animal nook.Key, c nook.Character) {
if ok := c.Animal.Key == animal; !ok {
t.Fatalf("%s.Animal != animal.%s", c.Key, animal)
}
}
func testCharacterBirthday(t *testing.T, c nook.Character) {
if ok := c.Birthday.Ok(); !ok {
t.Logf("%s.Birthday.Ok() != true", c.Key)
}
}
func testCharacterGender(t *testing.T, c nook.Character) {
if ok := reflect.ValueOf(c.Gender).IsZero(); ok {
t.Fatalf("%s.Gender is a zero value", c.Key)
}
}
func testCharacterName(t *testing.T, c nook.Character) {
if ok := len(c.Name) != 0; !ok {
t.Fatalf("len(%s.Name) == 0", c.Key)
}
}