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

Function TestDecrementInt64

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

Source from the content-addressed store, hash-verified

958}
959
960func TestDecrementInt64(t *testing.T) {
961 tc := New(DefaultExpiration, 0)
962 tc.Set("int64", int64(5), DefaultExpiration)
963 n, err := tc.DecrementInt64("int64", 2)
964 if err != nil {
965 t.Error("Error decrementing:", err)
966 }
967 if n != 3 {
968 t.Error("Returned number is not 3:", n)
969 }
970 x, found := tc.Get("int64")
971 if !found {
972 t.Error("int64 was not found")
973 }
974 if x.(int64) != 3 {
975 t.Error("int64 is not 3:", x)
976 }
977}
978
979func TestDecrementUint(t *testing.T) {
980 tc := New(DefaultExpiration, 0)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected