INNER CODE UNIT · Go

testGetPolicyWithoutOrder

apache/casbin-mongodb-adapter · adapter_test.go:62

func testGetPolicyWithoutOrder(t *testing.T, e *casbin.Enforcer, res [][]string) {
	myRes, err := e.GetPolicy()
	if err != nil {
		t.Fatalf("GetPolicy() failed: %v", err)
	}

	if !arrayEqualsWithoutOrder(myRes, res) {
		t.Error("Policy: ", myRes, ", supposed to be ", res)
	}
}

func arrayEqualsWithoutOrder(a [][]string, b [][]string) bool {
	if len(a) != len(b) {
		return false
	}

	mapA := make(map[int]string)
	mapB := make(map[int]string)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…