diff --git a/patterns/patterns_test.go b/patterns/patterns_test.go index 55e3e111..70b2a92e 100644 --- a/patterns/patterns_test.go +++ b/patterns/patterns_test.go @@ -64,48 +64,49 @@ func TestABAC(t *testing.T) { exa := `A [6 3 3] [r r c] [0] [1] [2] -[0 0] 0 1 0 -[0 1] 1 0 1 -[0 2] 0 0 0 -[1 0] 1 0 1 -[1 1] 1 0 0 -[1 2] 0 0 0 -[2 0] 0 0 0 -[2 1] 1 0 0 -[2 2] 1 1 0 -[3 0] 0 1 0 -[3 1] 0 0 0 -[3 2] 1 0 1 -[4 0] 1 0 1 -[4 1] 0 1 0 -[4 2] 0 0 0 -[5 0] 1 0 0 -[5 1] 0 0 1 -[5 2] 1 0 0 +[0 0] 0 1 1 +[0 1] 0 0 0 +[0 2] 0 0 1 +[1 0] 1 0 0 +[1 1] 0 0 0 +[1 2] 0 1 1 +[2 0] 1 1 0 +[2 1] 0 0 0 +[2 2] 0 0 1 +[3 0] 0 0 0 +[3 1] 0 1 0 +[3 2] 1 1 0 +[4 0] 0 1 0 +[4 1] 0 0 0 +[4 2] 1 1 0 +[5 0] 0 0 1 +[5 1] 0 1 1 +[5 2] 0 0 0 ` + // fmt.Println(a) assert.Equal(t, exa, a.String()) exb := `B [6 3 3] [r r c] [0] [1] [2] -[0 0] 1 0 0 -[0 1] 0 1 0 -[0 2] 1 0 0 -[1 0] 1 0 0 -[1 1] 1 1 0 -[1 2] 0 0 0 +[0 0] 0 1 0 +[0 1] 0 0 0 +[0 2] 1 1 0 +[1 0] 0 0 0 +[1 1] 0 1 1 +[1 2] 1 0 0 [2 0] 0 0 0 -[2 1] 0 1 1 -[2 2] 0 0 1 -[3 0] 1 1 0 -[3 1] 0 0 0 -[3 2] 0 1 0 -[4 0] 0 0 0 -[4 1] 1 1 0 -[4 2] 1 0 0 -[5 0] 0 0 0 -[5 1] 0 0 1 -[5 2] 1 1 0 +[2 1] 1 0 1 +[2 2] 0 1 0 +[3 0] 0 0 0 +[3 1] 1 1 0 +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