-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbool_test.go
More file actions
68 lines (61 loc) · 1.16 KB
/
Copy pathbool_test.go
File metadata and controls
68 lines (61 loc) · 1.16 KB
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
package is_test
import (
"testing"
"github.com/Alonza0314/is"
)
func TestBool(t *testing.T) {
testTrue(t)
testFalse(t)
}
var testBoolTrueCases = []struct {
name string
input bool
expected bool
}{
{
name: "True input in is.True should return true",
input: true,
expected: true,
},
{
name: "False input in is.True should return false",
input: false,
expected: false,
},
}
func testTrue(t *testing.T) {
for _, tc := range testBoolTrueCases {
t.Run(tc.name, func(t *testing.T) {
result := is.True(tc.input)
if result != tc.expected {
t.Errorf("Expected %v, got %v", tc.expected, result)
}
})
}
}
var testFalseCases = []struct {
name string
input bool
expected bool
}{
{
name: "True input in is.False should return false",
input: true,
expected: false,
},
{
name: "False input in is.False should return true",
input: false,
expected: true,
},
}
func testFalse(t *testing.T) {
for _, tc := range testFalseCases {
t.Run(tc.name, func(t *testing.T) {
result := is.False(tc.input)
if result != tc.expected {
t.Errorf("Expected %v, got %v", tc.expected, result)
}
})
}
}