-
Notifications
You must be signed in to change notification settings - Fork 20
/
utils_test.go
55 lines (44 loc) · 1.18 KB
/
utils_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
package goga_test
import (
. "gopkg.in/check.v1"
)
// -----------------------------------------------------------------------
// IsTrue checker.
type isTrueChecker struct {
*CheckerInfo
}
// The IsTrue checker tests whether the obtained value is true.
//
// For example:
//
// c.Assert(val, IsTrue)
//
var IsTrue Checker = &isTrueChecker{
&CheckerInfo{Name: "IsTrue", Params: []string{"value"}},
}
func (checker *isTrueChecker) Check(params []interface{}, names []string) (result bool, error string) {
return isTrue(params[0]), ""
}
func isTrue(obtained interface{}) (result bool) {
return (obtained == true)
}
// -----------------------------------------------------------------------
// IsFalse checker.
type isFalseChecker struct {
*CheckerInfo
}
// The IsFalse checker tests whether the obtained value is true.
//
// For example:
//
// c.Assert(val, IsFalse)
//
var IsFalse Checker = &isFalseChecker{
&CheckerInfo{Name: "IsFalse", Params: []string{"value"}},
}
func (checker *isFalseChecker) Check(params []interface{}, names []string) (result bool, error string) {
return isFalse(params[0]), ""
}
func isFalse(obtained interface{}) (result bool) {
return (obtained == false)
}