MCPcopy Create free account
hub / github.com/araddon/qlbridge / TestMapNumberValue

Function TestMapNumberValue

value/value_test.go:421–438  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

419 assert.Equal(t, int64(10), mv.Val()["k1"].Value())
420}
421func TestMapNumberValue(t *testing.T) {
422 mfv := map[string]float64{"k1": 10}
423 v := NewMapNumberValue(mfv)
424 _, ok := v.Get("k1")
425 assert.True(t, ok)
426 _, ok = v.Get("nope")
427 assert.Equal(t, false, ok)
428 assert.Equal(t, 1, v.MapValue().Len())
429 lv := v.SliceValue()
430 assert.Equal(t, 1, len(lv))
431 mi := v.MapInt()
432 assert.Equal(t, 1, len(mi))
433 assert.Equal(t, int64(10), mi["k1"])
434
435 mv := v.MapValue()
436 assert.Equal(t, 1, mv.Len())
437 assert.Equal(t, float64(10), mv.Val()["k1"].Value())
438}
439func TestMapTimeValue(t *testing.T) {
440 n := time.Now()
441 mtv := map[string]time.Time{"k1": n}

Callers

nothing calls this directly

Calls 9

GetMethod · 0.95
MapValueMethod · 0.95
SliceValueMethod · 0.95
MapIntMethod · 0.95
NewMapNumberValueFunction · 0.85
EqualMethod · 0.65
LenMethod · 0.65
ValueMethod · 0.65
ValMethod · 0.45

Tested by

no test coverage detected