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

Function TestSismember

IceFireDB-Redis-Proxy/test/cmd_set_test.go:123–166  ·  view source on GitHub ↗

Test SISMEMBER

(t *testing.T)

Source from the content-addressed store, hash-verified

121
122// Test SISMEMBER
123func TestSismember(t *testing.T) {
124 server.Clear()
125 c, err := proto.Dial(server.Addr())
126 ok(t, err)
127 defer c.Close()
128 s := server.Direct()
129
130 s.SetAdd("s", "aap", "noot", "mies")
131
132 {
133 must1(t, c, "SISMEMBER", "s", "aap")
134
135 must0(t, c, "SISMEMBER", "s", "nosuch")
136 }
137
138 // a nonexisting key
139 must0(t, c, "SISMEMBER", "nosuch", "nosuch")
140
141 t.Run("direct usage", func(t *testing.T) {
142 isMember, err := s.IsMember("s", "noot")
143 ok(t, err)
144 equals(t, true, isMember)
145 })
146
147 t.Run("errors", func(t *testing.T) {
148 mustOK(t, c, "SET", "str", "value")
149 mustDo(t, c,
150 "SISMEMBER", "str", "foo",
151 proto.Error(msgWrongType),
152 )
153 mustDo(t, c,
154 "SISMEMBER",
155 proto.Error(errWrongNumber("sismember")),
156 )
157 mustDo(t, c,
158 "SISMEMBER", "set",
159 proto.Error(errWrongNumber("sismember")),
160 )
161 mustDo(t, c,
162 "SISMEMBER", "set", "spurious", "args",
163 proto.Error(errWrongNumber("sismember")),
164 )
165 })
166}
167
168// Test SREM
169func TestSrem(t *testing.T) {

Callers

nothing calls this directly

Calls 14

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
ErrorFunction · 0.92
okFunction · 0.70
must1Function · 0.70
must0Function · 0.70
equalsFunction · 0.70
mustOKFunction · 0.70
mustDoFunction · 0.70
errWrongNumberFunction · 0.70

Tested by

no test coverage detected