-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray_test.go
31 lines (26 loc) · 1.67 KB
/
array_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
package bool_array
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestNew(t *testing.T) {
assert.Equal(t, "0", New(1).ToBinaryString())
assert.Equal(t, "00", New(2).ToBinaryString())
assert.Equal(t, "000", New(3).ToBinaryString())
assert.Equal(t, "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", New(1024).ToBinaryString())
}
func TestBoolArray_Set(t *testing.T) {
array := New(10)
array.Set(1, true)
assert.Equal(t, "0100000000", array.ToBinaryString())
for i := 2; i < 10; i++ {
array.Set(i, true)
}
assert.Equal(t, "0111111111", array.ToBinaryString())
}
func TestBoolArray_Get(t *testing.T) {
array := New(12)
array.Set(10, true)
value := array.Get(10)
assert.Equal(t, true, value)
}