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

Function TestStringBitPos

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

Source from the content-addressed store, hash-verified

636}
637
638func TestStringBitPos(t *testing.T) {
639 CallTest("set", "bit-pos", "5")
640 tests := []struct {
641 name string
642 args []string
643 want string
644 }{
645 {
646 name: "1",
647 args: []string{"bit-pos", "2"},
648 want: ErrBitInvaild.Error(),
649 },
650 {
651 name: "2",
652 args: []string{"bitnpos", "0", "0", "1"},
653 want: ":0",
654 },
655 {
656 name: "3",
657 args: []string{"bitnpos", "1", "0", "1"},
658 want: ":-1",
659 },
660 {
661 name: "4",
662 args: []string{"bit-pos", "1", "1", "1"},
663 want: ":-1",
664 },
665 {
666 name: "5",
667 args: []string{"bit-pos", "1", "1"},
668 want: ":-1",
669 },
670 {
671 name: "6",
672 args: []string{"bit-pos", "1"},
673 want: ":2",
674 },
675 {
676 name: "7",
677 args: []string{"bit-pos", "1", "1", "1", "1", "1"},
678 want: ErrSyntax.Error(),
679 },
680 }
681
682 for _, tt := range tests {
683 t.Run(tt.name, func(t *testing.T) {
684 out := CallTest("bitpos", tt.args...)
685 assert.Contains(t, out.String(), tt.want)
686 })
687 }
688}

Callers

nothing calls this directly

Calls 3

CallTestFunction · 0.85
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected