From 37e3172ed0fb24c12d50e380817c685c464b9521 Mon Sep 17 00:00:00 2001 From: Paul Mach Date: Thu, 5 Jan 2023 12:03:55 -0800 Subject: [PATCH] encoding/mvt: remove use of crypto/md5 to compare marshalling in tests --- encoding/mvt/marshal_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/encoding/mvt/marshal_test.go b/encoding/mvt/marshal_test.go index fe20cc7..f92c3f9 100644 --- a/encoding/mvt/marshal_test.go +++ b/encoding/mvt/marshal_test.go @@ -1,8 +1,7 @@ package mvt import ( - "crypto/md5" - "encoding/hex" + "bytes" "encoding/json" "fmt" "io/ioutil" @@ -542,17 +541,13 @@ func TestMarshal_ID(t *testing.T) { func TestStableMarshalling(t *testing.T) { layers := NewLayers(loadGeoJSON(t, maptile.New(17896, 24449, 16))) - values := make(map[string]bool) + firstData, _ := Marshal(layers) for i := 0; i < 100; i++ { - marshal, _ := Marshal(layers) - checksum := md5.Sum(marshal) - sum := hex.EncodeToString(checksum[:]) - values[sum] = true - } - - if len(values) != 1 { - t.Errorf("multiple values (%d) for marshalled bytes", len(values)) + data, _ := Marshal(layers) + if !bytes.Equal(data, firstData) { + t.Errorf("a marshal had different bytes") + } } }