Return 1 if the reply matches the specified integer, otherwise log errors * in the server log and return 0. */
| 410 | /* Return 1 if the reply matches the specified integer, otherwise log errors |
| 411 | * in the server log and return 0. */ |
| 412 | int 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 { \ |