-
Notifications
You must be signed in to change notification settings - Fork 0
/
bool_test.go
25 lines (21 loc) · 985 Bytes
/
bool_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
package utils
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSliceOfBool(t *testing.T) {
sob := []bool{true, false}
dsob := []bool{true, true, false}
// assert.Equal(t, "a", SliceOfBool(sob).First(""), "they should be equal")
// assert.Equal(t, "c", SliceOfBool(sob).Last(""), "they should be equal")
assert.Equal(t, true, SliceOfBool(sob).InSlice(false), "they should be equal")
assert.Equal(t, sob, SliceOfBool(dsob).Unique(), "they should be equal")
}
func TestSliceOfPtrBool(t *testing.T) {
sopb := []*bool{NewPtrBool(true), NewPtrBool(false)}
dsopb := []*bool{NewPtrBool(true), NewPtrBool(true), NewPtrBool(false)}
// assert.Equal(t, "a", *(SliceOfPtrBool(sopb).First("")), "they should be equal")
// assert.Equal(t, "c", *(SliceOfPtrBool(sopb).Last("")), "they should be equal")
assert.Equal(t, true, SliceOfPtrBool(sopb).InSlice(true), "they should be equal")
assert.Equal(t, sopb, SliceOfPtrBool(dsopb).Unique(), "they should be equal")
}