forked from Graphmasters/occamy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage_test.go
60 lines (47 loc) · 1.13 KB
/
package_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
package occamy_test
import (
"reflect"
"testing"
)
func assertEqual(t *testing.T, expected, actual interface{}, msg string) bool {
if reflect.DeepEqual(expected, actual) {
return true
}
t.Errorf("%s: expected and actual values did not match", msg)
return false
}
func assertNotEqual(t *testing.T, expected, actual interface{}, msg string) bool {
if !reflect.DeepEqual(expected, actual) {
return true
}
t.Errorf("%s: expected and actual values matched", msg)
return false
}
func assertError(t *testing.T, err error, msg string) bool {
if err != nil {
return true
}
t.Errorf("%s: error was expected to be nil", msg)
return false
}
func assertNoError(t *testing.T, err error, msg string) bool {
if err == nil {
return true
}
t.Errorf("%s: error was expected to be nil: %v", msg, err)
return false
}
func assertTrue(t *testing.T, value bool, msg string) bool {
if value {
return true
}
t.Errorf("%s: value was expected to be true", msg)
return false
}
func assertFalse(t *testing.T, value bool, msg string) bool {
if !value {
return true
}
t.Errorf("%s: value was expected to be false", msg)
return false
}