From 187d6dc500784760654b740a278fef59072ca5a8 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Sun, 26 Jun 2022 15:40:18 -0700 Subject: Refactor user access bitmap handling --- hotline/access_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 hotline/access_test.go (limited to 'hotline/access_test.go') 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) + }) + } +} -- cgit