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

Function TestStringSetBit

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

Source from the content-addressed store, hash-verified

505}
506
507func TestStringSetBit(t *testing.T) {
508 tests := []struct {
509 name string
510 args []string
511 want string
512 }{
513 {
514 name: "1",
515 args: []string{"setbit", "1", "0", "0"},
516 want: "-ERR wrong number of arguments for 'setbit' command",
517 },
518 {
519 name: "2",
520 args: []string{"setbit", "x", "0"},
521 want: ErrBitOffset.Error(),
522 },
523 {
524 name: "3",
525 args: []string{"setbit", "1", "x"},
526 want: ErrBitInteger.Error(),
527 },
528 {
529 name: "4",
530 args: []string{"setbit", "1", "2"},
531 want: ErrBitInteger.Error(),
532 },
533 {
534 name: "5",
535 args: []string{"setbit", "1", "1"},
536 want: ":0",
537 },
538 {
539 name: "6",
540 args: []string{"setbit", "1", "0"},
541 want: ":1",
542 },
543 }
544
545 for _, tt := range tests {
546 t.Run(tt.name, func(t *testing.T) {
547 out := CallTest("setbit", tt.args...)
548 assert.Contains(t, out.String(), tt.want)
549 })
550 }
551}
552
553func TestStringGetBit(t *testing.T) {
554 CallTest("setbit", "getbit", "5", "1")

Callers

nothing calls this directly

Calls 3

CallTestFunction · 0.85
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected