-
Notifications
You must be signed in to change notification settings - Fork 0
/
course_test.go
45 lines (38 loc) · 911 Bytes
/
course_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
package opendata
import "testing"
func TestParseCourseFullWidth(t *testing.T) {
course := ParseCourse("NETS1120001")
if course == nil || course.string != "NETS1120001" {
t.Fail()
}
}
func TestParseCourseTrimWidth(t *testing.T) {
course := ParseCourse("CIS1200001")
if course == nil || course.string != "CIS1200001" {
t.Fail()
}
}
func TestParseCourseInvalidCourse(t *testing.T) {
course := ParseCourse("CIS000001")
if course != nil {
t.Fail()
}
}
func TestParseCourseInvalidDepartWidth(t *testing.T) {
course := ParseCourse("CISXX000001")
if course != nil {
t.Fail()
}
}
func TestParseCourseNormalized(t *testing.T) {
course := ParseCourse("CIS-1200-001")
if course == nil || course.string != "CIS1200001" {
t.Fail()
}
}
func TestParseCourseMultiTerm(t *testing.T) {
course := ParseCourse("CRIM-6004A-301")
if course == nil || course.string != "CRIM6004A301" {
t.Fail()
}
}