MCPcopy
hub / github.com/aceld/zinx / TestRemove

Function TestRemove

zutils/shard_lock_map_test.go:103–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestRemove(t *testing.T) {
104 slm := NewShardLockMaps()
105
106 david := TestUser{"David"}
107 slm.Set("david", david)
108
109 slm.Remove("david")
110
111 if slm.Count() != 0 {
112 t.Error("Expecting count to be zero once item was removed.")
113 }
114
115 temp, ok := slm.Get("david")
116
117 if ok != false {
118 t.Error("Expecting ok to be false for missing items.")
119 }
120
121 if temp != nil {
122 t.Error("Expecting item to be nil after its removal.")
123 }
124
125 slm.Remove("user")
126
127 isEmpty := slm.IsEmpty()
128 if !isEmpty {
129 t.Error("map should be empty.")
130 }
131
132}
133
134func TestRemoveCb(t *testing.T) {
135 slm := NewShardLockMaps()

Callers

nothing calls this directly

Calls 7

SetMethod · 0.95
RemoveMethod · 0.95
CountMethod · 0.95
GetMethod · 0.95
IsEmptyMethod · 0.95
NewShardLockMapsFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected