MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / TestAssertIntegerReply

Function TestAssertIntegerReply

tests/modules/basics.c:412–430  ·  view source on GitHub ↗

Return 1 if the reply matches the specified integer, otherwise log errors * in the server log and return 0. */

Source from the content-addressed store, hash-verified

410/* Return 1 if the reply matches the specified integer, otherwise log errors
411 * in the server log and return 0. */
412int TestAssertIntegerReply(RedisModuleCtx *ctx, RedisModuleCallReply *reply, long long expected) {
413 if (RedisModule_CallReplyType(reply) == REDISMODULE_REPLY_ERROR) {
414 RedisModule_Log(ctx,"warning","Test error reply: %s",
415 RedisModule_CallReplyStringPtr(reply, NULL));
416 return 0;
417 } else if (RedisModule_CallReplyType(reply) != REDISMODULE_REPLY_INTEGER) {
418 RedisModule_Log(ctx,"warning","Unexpected reply type %d",
419 RedisModule_CallReplyType(reply));
420 return 0;
421 }
422 long long val = RedisModule_CallReplyInteger(reply);
423 if (val != expected) {
424 RedisModule_Log(ctx,"warning",
425 "Unexpected integer reply '%lld' (instead of '%lld')",
426 val, expected);
427 return 0;
428 }
429 return 1;
430}
431
432#define T(name,...) \
433 do { \

Callers 1

TestBasicsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected