From 716a3a89c1684bab4891827d3f2a6d348f8e32e4 Mon Sep 17 00:00:00 2001 From: reesporte Date: Mon, 6 Dec 2021 16:16:43 -0600 Subject: [PATCH] added test case --- encoding/proto/proto_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/encoding/proto/proto_test.go b/encoding/proto/proto_test.go index 51bd18916..96aa0d7f1 100644 --- a/encoding/proto/proto_test.go +++ b/encoding/proto/proto_test.go @@ -168,3 +168,22 @@ func TestEncodeDecodeDistinctTimestamp(t *testing.T) { t.Errorf("failed to encode DistinctTimestamp. expected %v got %v", &pbTime, encoded) } } + +func TestDecodeQueryResult(t *testing.T) { + t.Run("DistinctTimestamp", func(t *testing.T) { + pbTime := pb.DistinctTimestamp{ + Values: []string{"this", "is", "fake", "timestamp", "values"}, + Name: "pbtime", + } + piloTime := pilosa.DistinctTimestamp{ + Values: []string{"this", "is", "fake", "timestamp", "values"}, + Name: "pbtime", + } + q := &pb.QueryResult{Type: queryResultTypeDistinctTimestamp, DistinctTimestamp: &pbTime} + s := Serializer{} + decoded := s.decodeQueryResult(q) + if !reflect.DeepEqual(decoded, piloTime) { + t.Errorf("failed to decode DistinctTimestamp. expected %v got %v", piloTime, decoded) + } + }) +}