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

Function TestMapIntValue

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

Source from the content-addressed store, hash-verified

398}
399
400func TestMapIntValue(t *testing.T) {
401 miv := map[string]int64{"k1": 10}
402 v := NewMapIntValue(miv)
403 _, ok := v.Get("k1")
404 assert.True(t, ok)
405 _, ok = v.Get("nope")
406 assert.Equal(t, false, ok)
407 assert.Equal(t, 1, v.MapValue().Len())
408 lv := v.SliceValue()
409 assert.Equal(t, 1, len(lv))
410 mi := v.MapInt()
411 assert.Equal(t, 1, len(mi))
412 assert.Equal(t, int64(10), mi["k1"])
413 mf := v.MapFloat()
414 assert.Equal(t, 1, len(mf))
415 assert.Equal(t, float64(10), mf["k1"])
416
417 mv := v.MapValue()
418 assert.Equal(t, 1, mv.Len())
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)

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected