MCPcopy Index your code
hub / github.com/netdata/netdata / TestFieldSummary_StringAndJSON

Function TestFieldSummary_StringAndJSON

src/go/pkg/funcapi/enums_test.go:114–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func TestFieldSummary_StringAndJSON(t *testing.T) {
115 cases := []struct {
116 value FieldSummary
117 expected string
118 }{
119 {FieldSummaryCount, "count"},
120 {FieldSummaryUniqueCount, "uniqueCount"},
121 {FieldSummarySum, "sum"},
122 {FieldSummaryMin, "min"},
123 {FieldSummaryMax, "max"},
124 {FieldSummaryMean, "mean"},
125 {FieldSummaryMedian, "median"},
126 {FieldSummary(250), "count"},
127 }
128
129 for _, tc := range cases {
130 t.Run(tc.expected, func(t *testing.T) {
131 assert.Equal(t, tc.expected, tc.value.String())
132 data, err := json.Marshal(tc.value)
133 require.NoError(t, err)
134 assert.Equal(t, `"`+tc.expected+`"`, string(data))
135 })
136 }
137}
138
139func TestFieldFilter_StringAndJSON(t *testing.T) {
140 cases := []struct {

Callers

nothing calls this directly

Calls 4

FieldSummaryTypeAlias · 0.85
EqualMethod · 0.80
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…