policy/main.go
Anatoly Prohacky 1c01e2dc29 Verify Mask
2023-03-11 18:06:30 +10:00

56 lines
1021 B
Go

package main
import (
"fmt"
"gitstore.ru/tolikproh/policy/acl"
)
func main() {
a := acl.New(0, 1, 2, 3, 4, 32, 60, 61, 62, 63)
fmt.Println(a)
fmt.Println(a.String())
fmt.Println(a.Int64())
b := fmt.Sprintf("%b", a)
fmt.Println(b)
fmt.Println(a.Verify(0))
a.SetFalse(0)
fmt.Println(a.Verify(0))
fmt.Println(a.Verify(1))
a.SetFalse(1)
fmt.Println(a.Verify(1))
fmt.Println(a.Verify(2))
a.SetFalse(2)
fmt.Println(a.Verify(2))
fmt.Println(a.Verify(3))
a.SetFalse(3)
fmt.Println(a.Verify(3))
fmt.Println(a.Verify(4))
a.SetFalse(4)
fmt.Println(a.Verify(4))
fmt.Println(a.Verify(5))
a.SetTrue(5)
fmt.Println(a.Verify(5))
fmt.Println(a.Verify(32))
a.SetFalse(32)
fmt.Println(a.Verify(32))
fmt.Println(a.Verify(62))
a.SetFalse(62)
fmt.Println(a.Verify(62))
a.SetTrue(63)
fmt.Println(a.Verify(63))
a.SetFalse(63)
fmt.Println(a.Verify(63))
var ret acl.AclBit
var i acl.NumBit
for i = 0; i < 63; i++ {
ret.SetTrue(i)
}
fmt.Println(ret)
fmt.Println(acl.AllBit)
fmt.Println(16 & 32)
}