policy/acl/aclbit_test.go

24 lines
480 B
Go
Raw Normal View History

2022-08-13 08:47:44 +03:00
package acl_test
import (
"testing"
"github.com/stretchr/testify/assert"
"gitstore.ru/tolikproh/policy/acl"
)
func Test_Acl(t *testing.T) {
t.Run("Valid AclBits", func(t *testing.T) {
for i := 0; i < 63; i++ {
a := acl.New(acl.NumBit(i))
2023-03-04 09:30:21 +02:00
assert.Equal(t, true, a.Verify(acl.NumBit(i)))
2022-08-13 08:47:44 +03:00
}
})
t.Run("NotValid AclBits", func(t *testing.T) {
for i := -63; i == 0; i++ {
a := acl.New(acl.NumBit(i))
2023-03-04 09:30:21 +02:00
assert.NotEqual(t, true, a.Verify(acl.NumBit(i)))
2022-08-13 08:47:44 +03:00
}
})
}