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

Function TestSscan

IceFireDB-PubSub/test/cmd_set_test.go:750–837  ·  view source on GitHub ↗

Test SDIFF *func TestSdiff(t *testing.T) { server.Clear() c, err := proto.Dial(server.Addr()) ok(t, err) defer c.Close() s := server.Direct() s.SetAdd("s1", "aap", "noot", "mies") s.SetAdd("s2", "noot", "mies", "vuur") s.SetAdd("s3", "aap", "mies", "wim") // Simple case mustDo(t, c, "S

(t *testing.T)

Source from the content-addressed store, hash-verified

748}
749*/
750func TestSscan(t *testing.T) {
751 server.Clear()
752 c, err := proto.Dial(server.Addr())
753 ok(t, err)
754 defer c.Close()
755 s := server.Direct()
756
757 // We cheat with sscan. It always returns everything.
758
759 s.SetAdd("set", "value1", "value2")
760
761 // No problem
762 mustDo(t, c,
763 "SSCAN", "set", "0",
764 proto.Array(
765 proto.String("0"),
766 proto.Array(
767 proto.String("value1"),
768 proto.String("value2"),
769 ),
770 ),
771 )
772
773 // Invalid cursor
774 mustDo(t, c,
775 "SSCAN", "set", "42",
776 proto.Array(
777 proto.String("0"),
778 proto.Strings(),
779 ),
780 )
781
782 // COUNT (ignored)
783 mustDo(t, c,
784 "SSCAN", "set", "0", "COUNT", "200",
785 proto.Array(
786 proto.String("0"),
787 proto.Array(
788 proto.String("value1"),
789 proto.String("value2"),
790 ),
791 ),
792 )
793
794 // MATCH
795 s.SetAdd("set", "aap", "noot", "mies")
796 mustDo(t, c,
797 "SSCAN", "set", "0", "MATCH", "mi*",
798 proto.Array(
799 proto.String("0"),
800 proto.Array(
801 proto.String("mies"),
802 ),
803 ),
804 )
805
806 t.Run("errors", func(t *testing.T) {
807 mustDo(t, c,

Callers

nothing calls this directly

Calls 14

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
ArrayFunction · 0.92
StringFunction · 0.92
StringsFunction · 0.92
ErrorFunction · 0.92
SetMethod · 0.80
okFunction · 0.70
mustDoFunction · 0.70
errWrongNumberFunction · 0.70

Tested by

no test coverage detected