From c96a39d3158dc30b4f96e10bbb4c68d96e9bc3b7 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Fri, 24 Feb 2012 22:52:37 +0100 Subject: [PATCH] go: Fix unit test for non-deterministic map ordering --- go/msgpack_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/go/msgpack_test.go b/go/msgpack_test.go index 2cdad6de..081be7b2 100644 --- a/go/msgpack_test.go +++ b/go/msgpack_test.go @@ -246,7 +246,14 @@ func TestPackMap(t *testing.T) { if err != nil { t.Error("err != nil") } - if bytes.Compare(b.Bytes(), []byte{0x83, 0x00, 0x01, 0x04, 0x05, 0x02, 0x03}) != 0 { + + // map ordering is no longer deterministic -- check all possible orderings :( + if bytes.Compare(b.Bytes(), []byte{0x83, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05}) != 0 && + bytes.Compare(b.Bytes(), []byte{0x83, 0x00, 0x01, 0x04, 0x05, 0x02, 0x03}) != 0 && + bytes.Compare(b.Bytes(), []byte{0x83, 0x02, 0x03, 0x00, 0x01, 0x04, 0x05}) != 0 && + bytes.Compare(b.Bytes(), []byte{0x83, 0x02, 0x03, 0x04, 0x05, 0x00, 0x01}) != 0 && + bytes.Compare(b.Bytes(), []byte{0x83, 0x04, 0x05, 0x00, 0x01, 0x02, 0x03}) != 0 && + bytes.Compare(b.Bytes(), []byte{0x83, 0x04, 0x05, 0x02, 0x03, 0x00, 0x01}) != 0 { t.Error("wrong output", b.Bytes()) } }