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

Function TestIncrementInt64

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

Source from the content-addressed store, hash-verified

730}
731
732func TestIncrementInt64(t *testing.T) {
733 tc := New(DefaultExpiration, 0)
734 tc.Set("tint64", int64(1), DefaultExpiration)
735 n, err := tc.IncrementInt64("tint64", 2)
736 if err != nil {
737 t.Error("Error incrementing:", err)
738 }
739 if n != 3 {
740 t.Error("Returned number is not 3:", n)
741 }
742 x, found := tc.Get("tint64")
743 if !found {
744 t.Error("tint64 was not found")
745 }
746 if x.(int64) != 3 {
747 t.Error("tint64 is not 3:", x)
748 }
749}
750
751func TestIncrementUint(t *testing.T) {
752 tc := New(DefaultExpiration, 0)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected