MCPcopy
hub / github.com/grafana/tempo / TestStatic_FloatArray

Function TestStatic_FloatArray

pkg/traceql/ast_test.go:333–367  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

331}
332
333func TestStatic_FloatArray(t *testing.T) {
334 tests := []struct {
335 arg any
336 ok bool
337 }{
338 // supported values
339 {arg: []float64(nil), ok: true},
340 {arg: []float64{}, ok: true},
341 {arg: []float64{1.11}, ok: true},
342 {arg: []float64{1.11 + math.SmallestNonzeroFloat64}, ok: true},
343 {arg: []float64{1.23, 2.0, 3.14, 4.1, 5.15}, ok: true},
344 // unsupported values
345 {arg: 1},
346 {arg: 3.14},
347 {arg: "test"},
348 {arg: true},
349 {arg: StatusOk},
350 {arg: KindClient},
351 {arg: []int{1, 2}},
352 {arg: []bool{true, true}},
353 {arg: []string{"aa", "bb"}},
354 }
355
356 for _, tt := range tests {
357 t.Run(testName(tt.arg), func(t *testing.T) {
358 static := newStatic(tt.arg)
359 f, ok := static.FloatArray()
360
361 require.Equal(t, tt.ok, ok)
362 if tt.ok {
363 assert.Equal(t, tt.arg, f)
364 }
365 })
366 }
367}
368
369func TestStatic_StringArray(t *testing.T) {
370 tests := []struct {

Callers

nothing calls this directly

Calls 5

testNameFunction · 0.85
newStaticFunction · 0.85
FloatArrayMethod · 0.80
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected