| 101 | } |
| 102 | |
| 103 | func 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 | |
| 134 | func TestRemoveCb(t *testing.T) { |
| 135 | slm := NewShardLockMaps() |