-
Notifications
You must be signed in to change notification settings - Fork 0
/
qualification_test.go
88 lines (65 loc) · 1.43 KB
/
qualification_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
package level2
import (
"github.com/sfomuseum/go-edtf"
"testing"
)
func TestQualification(t *testing.T) {
TestGroupQualification(t)
TestIndividualQualification(t)
}
func TestGroupQualification(t *testing.T) {
valid, ok := Tests[GROUP_QUALIFICATION]
if !ok {
t.Fatalf("Failed to load test strings")
}
for input, tr := range valid {
t.Logf("ParseGroupQualification '%s'", input)
d, err := ParseGroupQualification(input)
if err != nil {
if edtf.IsNotImplemented(err) {
t.Logf("Skipping '%s', %v", input, err)
continue
} else {
t.Logf("Failed to parse '%s', %v", input, err)
t.Fail()
continue
}
}
if tr != nil {
err := tr.TestDate(d)
if err != nil {
t.Logf("Results failed tests '%s', %v", input, err)
t.Fail()
continue
}
}
}
}
func TestIndividualQualification(t *testing.T) {
valid, ok := Tests[INDIVIDUAL_QUALIFICATION]
if !ok {
t.Logf("Failed to load test strings")
}
for input, tr := range valid {
t.Logf("ParseIndividualQualification '%s'", input)
d, err := ParseIndividualQualification(input)
if err != nil {
if edtf.IsNotImplemented(err) {
t.Logf("Skipping '%s', %v", input, err)
continue
} else {
t.Logf("Failed to parse '%s', %v", input, err)
t.Fail()
continue
}
}
if tr != nil {
err := tr.TestDate(d)
if err != nil {
t.Logf("Results failed tests '%s', %v", input, err)
t.Fail()
continue
}
}
}
}