aboutsummaryrefslogtreecommitdiff
path: root/hotline/access_test.go
blob: b262407d00adba719a1fcdb7f0ba9fd06c28d54b (plain)
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
package hotline

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func Test_accessBitmap_IsSet(t *testing.T) {
	type args struct {
		i int
	}
	tests := []struct {
		name string
		bits accessBitmap
		args args
		want bool
	}{
		{
			name: "returns true when bit is set",
			bits: func() (access accessBitmap) {
				access.Set(22)
				return access
			}(),
			args: args{i: 22},
			want: true,
		},
		{
			name: "returns false when bit is unset",
			bits: accessBitmap{},
			args: args{i: 22},
			want: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			assert.Equalf(t, tt.want, tt.bits.IsSet(tt.args.i), "IsSet(%v)", tt.args.i)
		})
	}
}