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

Function TestStringBitCount

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

Source from the content-addressed store, hash-verified

593}
594
595func TestStringBitCount(t *testing.T) {
596 CallTest("setbit", "bit-count", "5", "1")
597 CallTest("setbit", "bit-count", "9", "1")
598 tests := []struct {
599 name string
600 args []string
601 want string
602 }{
603 {
604 name: "1",
605 args: []string{"bit-count", "1"},
606 want: ErrSyntax.Error(),
607 },
608 {
609 name: "2",
610 args: []string{"bit-count", "x", "1"},
611 want: ErrInteger.Error(),
612 },
613 {
614 name: "3",
615 args: []string{"bit-count", "1", "x"},
616 want: ErrInteger.Error(),
617 },
618 {
619 name: "4",
620 args: []string{"bit-count"},
621 want: ":2",
622 },
623 {
624 name: "5",
625 args: []string{"bit-count", "1", "1"},
626 want: ":1",
627 },
628 }
629
630 for _, tt := range tests {
631 t.Run(tt.name, func(t *testing.T) {
632 out := CallTest("bitcount", tt.args...)
633 assert.Contains(t, out.String(), tt.want)
634 })
635 }
636}
637
638func TestStringBitPos(t *testing.T) {
639 CallTest("set", "bit-pos", "5")

Callers

nothing calls this directly

Calls 3

CallTestFunction · 0.85
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected