Fix tests when assert() undefined

Closes #309

(such as when -DNDEBUG disables all assert() macros)

Inspired by keith-bennett-gbg, but re-rewritten to be more concise.
This commit is contained in:
Matt Stancliff 2015-02-18 14:42:27 -05:00
parent 6b122d43f9
commit 27076a3e6d

7
test.c
View File

@ -43,6 +43,13 @@ static long long usec(void) {
return (((long long)tv.tv_sec)*1000000)+tv.tv_usec; return (((long long)tv.tv_sec)*1000000)+tv.tv_usec;
} }
/* The assert() calls below have side effects, so we need assert()
* even if we are compiling without asserts (-DNDEBUG). */
#ifdef NDEBUG
#undef assert
#define assert(e) (void)(e)
#endif
static redisContext *select_database(redisContext *c) { static redisContext *select_database(redisContext *c) {
redisReply *reply; redisReply *reply;