(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestMaxGauges(t *testing.T) { |
| 72 | type testcase struct { |
| 73 | exp float64 |
| 74 | mf MetricFamilyMap |
| 75 | } |
| 76 | |
| 77 | for _, tc := range []testcase{ |
| 78 | {exp: math.NaN(), mf: MetricFamilyMap{}}, |
| 79 | {exp: math.NaN(), mf: MetricFamilyMap{"metric": nil}}, |
| 80 | {exp: math.NaN(), mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: nil}}}, |
| 81 | {exp: math.NaN(), mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: []*dto.Metric{{Gauge: &dto.Gauge{}}}}}}, |
| 82 | {exp: 12345.6789, mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: []*dto.Metric{{Gauge: &dto.Gauge{Value: proto.Float64(12345.6789)}}}}}}, |
| 83 | {exp: 7890.12345, mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: []*dto.Metric{ |
| 84 | {Gauge: &dto.Gauge{Value: proto.Float64(1234.56789)}}, |
| 85 | {Gauge: &dto.Gauge{Value: proto.Float64(7890.12345)}}, |
| 86 | }}}}, |
| 87 | } { |
| 88 | checkFloats(t, tc.mf.MaxGauges("metric"), tc.exp) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestCounterValue(t *testing.T) { |
| 93 | require.Equal(t, float64(0), counterValue(nil)) |
nothing calls this directly
no test coverage detected