MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestSortedSetAdd

Function TestSortedSetAdd

IceFireDB-PubSub/test/cmd_sorted_set_test.go:178–301  ·  view source on GitHub ↗

Test ZADD

(t *testing.T)

Source from the content-addressed store, hash-verified

176
177// Test ZADD
178func TestSortedSetAdd(t *testing.T) {
179 server.Clear()
180 c, err := proto.Dial(server.Addr())
181 ok(t, err)
182 defer c.Close()
183 s := server.Direct()
184
185 {
186 mustDo(t, c,
187 "ZADD", "z", "1", "one", "2", "two", "3", "three",
188 proto.Int(3),
189 )
190
191 must0(t, c,
192 "ZADD", "z", "1", "one", "2.1", "two", "3", "three",
193 )
194
195 must1(t, c,
196 "ZADD", "z", "CH", "1", "one", "2.2", "two", "3", "three",
197 )
198
199 must0(t, c,
200 "ZADD", "z", "NX", "1", "one", "2.2", "two", "3", "three",
201 )
202
203 must1(t, c,
204 "ZADD", "z", "NX", "1", "one", "4", "four",
205 )
206
207 must0(t, c,
208 "ZADD", "z", "XX", "1.1", "one", "4", "four",
209 )
210
211 must1(t, c,
212 "ZADD", "z", "XX", "CH", "1.2", "one", "4", "four",
213 )
214
215 mustDo(t, c,
216 "ZADD", "z", "INCR", "1.2", "one",
217 proto.String("2.4"),
218 )
219
220 mustNil(t, c,
221 "ZADD", "z", "INCR", "NX", "1.2", "one",
222 )
223
224 mustDo(t, c,
225 "ZADD", "z", "INCR", "XX", "1.2", "one",
226 proto.String("3.6"),
227 )
228
229 mustNil(t, c,
230 "ZADD", "q", "INCR", "XX", "1.2", "one",
231 )
232
233 mustDo(t, c,
234 "ZADD", "q", "INCR", "NX", "1.2", "one",
235 proto.String("1.2"),

Callers

nothing calls this directly

Calls 15

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
IntFunction · 0.92
StringFunction · 0.92
ErrorFunction · 0.92
okFunction · 0.70
mustDoFunction · 0.70
must0Function · 0.70
must1Function · 0.70
mustNilFunction · 0.70

Tested by

no test coverage detected