aboutsummaryrefslogtreecommitdiff
path: root/hotline/access_test.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-26 15:40:18 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-26 15:40:18 -0700
commit187d6dc500784760654b740a278fef59072ca5a8 (patch)
tree856f011e322446bf16c0f77e676e82901d0dd93b /hotline/access_test.go
parentf168da153f3984af6d532b979219310242f0b8d1 (diff)
Refactor user access bitmap handling
Diffstat (limited to 'hotline/access_test.go')
-rw-r--r--hotline/access_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/hotline/access_test.go b/hotline/access_test.go
new file mode 100644
index 0000000..b262407
--- /dev/null
+++ b/hotline/access_test.go
@@ -0,0 +1,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)
+ })
+ }
+}