1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 func TestMarshalJSON(t *testing.T) {
21 Value: PointInt64Value{
30 Value: PointDoubleValue{
34 `{"doubleValue":3.14}`,
39 Value: PointDistributionValue{
40 DistributionValue: &DistributionValue{
51 BucketOptions: &BucketOptionsExplicit{
59 `{"distributionValue":{"count":3,"sum":10,"bucket_options":{"explicit":{"bounds":[0,5]}},"buckets":[{"count":1},{"count":2}]}}`,
68 for _, tt := range tests {
69 t.Run(tt.name, func(t *testing.T) {
70 buf, err := tt.pt.MarshalJSON()
72 t.Fatalf("Got:\n%v\nWant:\n%v", err, nil)
75 if !reflect.DeepEqual(got, tt.want) {
76 t.Fatalf("Got:\n%s\nWant:\n%s", got, tt.want)