(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestSampleValueJSONV2(t *testing.T) { |
| 25 | cases := []float64{ |
| 26 | math.Inf(1), |
| 27 | math.MaxFloat64, |
| 28 | math.MaxFloat32, |
| 29 | math.SmallestNonzeroFloat64, |
| 30 | math.SmallestNonzeroFloat32, |
| 31 | 1e21, |
| 32 | 1.0, |
| 33 | 1e-6, |
| 34 | 0, |
| 35 | -1e-6, |
| 36 | -1.0, |
| 37 | -1e21, |
| 38 | -math.MaxFloat64, |
| 39 | -math.MaxFloat32, |
| 40 | -math.SmallestNonzeroFloat64, |
| 41 | -math.SmallestNonzeroFloat32, |
| 42 | math.Inf(-1), |
| 43 | math.NaN(), |
| 44 | } |
| 45 | |
| 46 | for _, i := range cases { |
| 47 | t.Run(fmt.Sprintf("%v", i), func(t *testing.T) { |
| 48 | if i != -math.MaxFloat64 { |
| 49 | testV1V2Marshal(t, "-", SampleValue(math.Nextafter(i, math.Inf(-1)))) |
| 50 | } |
| 51 | testV1V2Marshal(t, "=", SampleValue(i)) |
| 52 | if i != math.MaxFloat64 { |
| 53 | testV1V2Marshal(t, "+", SampleValue(math.Nextafter(i, math.Inf(1)))) |
| 54 | } |
| 55 | }) |
| 56 | } |
| 57 | testRoundTrip(t, "-1", SampleValue(-1)) |
| 58 | testRoundTrip(t, "-1.1", SampleValue(-1.1)) |
| 59 | testRoundTrip(t, "0", SampleValue(0)) |
| 60 | testRoundTrip(t, "1", SampleValue(1)) |
| 61 | testRoundTrip(t, "1.1", SampleValue(1.1)) |
| 62 | } |
| 63 | |
| 64 | func TestSamplePairJSONV2(t *testing.T) { |
| 65 | cases := []SamplePair{ |
nothing calls this directly
no test coverage detected