MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / TestIncrementInt

Function TestIncrementInt

pkg/util/cache/cache_test.go:656–673  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

654}
655
656func TestIncrementInt(t *testing.T) {
657 tc := New(DefaultExpiration, 0)
658 tc.Set("tint", 1, DefaultExpiration)
659 n, err := tc.IncrementInt("tint", 2)
660 if err != nil {
661 t.Error("Error incrementing:", err)
662 }
663 if n != 3 {
664 t.Error("Returned number is not 3:", n)
665 }
666 x, found := tc.Get("tint")
667 if !found {
668 t.Error("tint was not found")
669 }
670 if x.(int) != 3 {
671 t.Error("tint is not 3:", x)
672 }
673}
674
675func TestIncrementInt8(t *testing.T) {
676 tc := New(DefaultExpiration, 0)

Callers

nothing calls this directly

Calls 5

IncrementIntMethod · 0.80
NewFunction · 0.70
SetMethod · 0.65
GetMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected