MCPcopy Create free account
hub / github.com/distributedio/titan / TestStringSetRange

Function TestStringSetRange

command/strings_test.go:326–367  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

324}
325
326func TestStringSetRange(t *testing.T) {
327 args := make([]string, 3)
328 key := "setrange"
329 args[0] = key
330 args[1] = "3"
331 args[2] = value
332
333 ctx := ContextTest("setrange", args...)
334 Call(ctx)
335 assert.Contains(t, ctxString(ctx.Out), "8")
336 ctx = ContextTest("get", key)
337 Call(ctx)
338 assert.Contains(t, ctxString(ctx.Out), value)
339
340 args[1] = "1"
341 args[2] = "lll"
342 ctx = ContextTest("setrange", args...)
343 Call(ctx)
344 assert.Contains(t, ctxString(ctx.Out), "8")
345 ctx = ContextTest("get", key)
346 Call(ctx)
347 assert.Contains(t, ctxString(ctx.Out), "lllalue")
348
349 args[1] = "10"
350 args[2] = value
351 ctx = ContextTest("setrange", args...)
352 Call(ctx)
353 assert.Contains(t, ctxString(ctx.Out), "15")
354 ctx = ContextTest("get", key)
355 Call(ctx)
356 assert.Contains(t, ctxString(ctx.Out), "\x00lllalue\x00\x00value")
357
358 args[1] = "s"
359 ctx = ContextTest("setrange", args...)
360 Call(ctx)
361 assert.Contains(t, ctxString(ctx.Out), ErrInteger.Error())
362
363 args[1] = "-2"
364 ctx = ContextTest("setrange", args...)
365 Call(ctx)
366 assert.Contains(t, ctxString(ctx.Out), ErrMaximum.Error())
367}
368func TestStringIncr(t *testing.T) {
369 args := make([]string, 1)
370 args[0] = "incr"

Callers

nothing calls this directly

Calls 4

ContextTestFunction · 0.85
CallFunction · 0.85
ctxStringFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected