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

Function TestMapTimeValue

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

Source from the content-addressed store, hash-verified

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}
442 v := NewMapTimeValue(mtv)
443 _, ok := v.Get("k1")
444 assert.True(t, ok)
445 _, ok = v.Get("nope")
446 assert.Equal(t, false, ok)
447 assert.Equal(t, 1, v.MapValue().Len())
448
449 mi := v.MapInt()
450 assert.Equal(t, 1, len(mi))
451 assert.True(t, CloseEnuf(float64(n.UnixNano()), float64(mi["k1"])))
452
453 mv := v.MapValue()
454 assert.Equal(t, 1, mv.Len())
455 assert.Equal(t, n, mv.Val()["k1"].Value())
456}
457func TestMapBoolValue(t *testing.T) {
458
459 mbv := map[string]bool{"k1": true}

Callers

nothing calls this directly

Calls 9

GetMethod · 0.95
MapValueMethod · 0.95
MapIntMethod · 0.95
NewMapTimeValueFunction · 0.85
CloseEnufFunction · 0.85
EqualMethod · 0.65
LenMethod · 0.65
ValueMethod · 0.65
ValMethod · 0.45

Tested by

no test coverage detected