summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-06-13 18:15:56 +0000
committerNick Mathewson <nickm@torproject.org>2007-06-13 18:15:56 +0000
commit546209a4de77402755121c75f1b8fc3083d0c82a (patch)
tree24e667136ab271bcbb345daef73001a4be67810d /src/common
parent3637ee0e596c08edf271563ef4ddbbebcfda7873 (diff)
downloadtor-546209a4de77402755121c75f1b8fc3083d0c82a.tar.gz
tor-546209a4de77402755121c75f1b8fc3083d0c82a.zip
r13384@catbus: nickm | 2007-06-13 13:53:26 -0400
make test_* functions stop conflicting with variables named v1 and v2. svn:r10584
Diffstat (limited to 'src/common')
-rw-r--r--src/common/test.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/common/test.h b/src/common/test.h
index 41b795a89a..134c9a3f2a 100644
--- a/src/common/test.h
+++ b/src/common/test.h
@@ -51,9 +51,9 @@ extern int have_failed;
#define test_eq_type(tp, fmt, expr1, expr2) \
STMT_BEGIN \
- tp v1=(tp)(expr1); \
- tp v2=(tp)(expr2); \
- if (v1==v2) { printf("."); fflush(stdout); } else { \
+ tp _test_v1=(tp)(expr1); \
+ tp _test_v2=(tp)(expr2); \
+ if (_test_v1==_test_v2) { printf("."); fflush(stdout); } else { \
have_failed = 1; \
printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n" \
" "fmt "!="fmt"\n", \
@@ -61,7 +61,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, #expr2, \
- v1, v2); \
+ _test_v1, _test_v2); \
return; \
} STMT_END
@@ -73,9 +73,9 @@ extern int have_failed;
#define test_neq_type(tp, fmt, expr1, expr2) \
STMT_BEGIN \
- tp v1=(tp)(expr1); \
- tp v2=(tp)(expr2); \
- if (v1!=v2) { printf("."); fflush(stdout); } else { \
+ tp _test_v1=(tp)(expr1); \
+ tp _test_v2=(tp)(expr2); \
+ if (_test_v1!=_test_v2) { printf("."); fflush(stdout); } else { \
have_failed = 1; \
printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n" \
" ("fmt" == "fmt")\n", \
@@ -83,7 +83,7 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, #expr2, \
- v1, v2); \
+ _test_v1, _test_v2); \
return; \
} STMT_END
@@ -95,8 +95,8 @@ extern int have_failed;
#define test_streq(expr1, expr2) \
STMT_BEGIN \
- const char *v1=(expr1), *v2=(expr2); \
- if (!strcmp(v1,v2)) { printf("."); fflush(stdout); } else { \
+ const char *_test_v1=(expr1), *_test_v2=(expr2); \
+ if (!strcmp(_test_v1,_test_v2)) { printf("."); fflush(stdout); } else { \
have_failed = 1; \
printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\
" (\"%s\" != \"%s\")\n", \
@@ -104,14 +104,14 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, #expr2, \
- v1, v2); \
+ _test_v1, _test_v2); \
return; \
} STMT_END
#define test_strneq(expr1, expr2) \
STMT_BEGIN \
- const char *v1=(expr1), *v2=(expr2); \
- if (strcmp(v1,v2)) { printf("."); fflush(stdout); } else { \
+ const char *_test_v1=(expr1), *_test_v2=(expr2); \
+ if (strcmp(_test_v1,_test_v2)) { printf("."); fflush(stdout); } else { \
have_failed = 1; \
printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n"\
" (\"%s\" == \"%s\")\n", \
@@ -119,14 +119,15 @@ extern int have_failed;
__LINE__, \
PRETTY_FUNCTION, \
#expr1, #expr2, \
- v1, v2); \
+ _test_v1, _test_v2); \
return; \
} STMT_END
#define test_memeq(expr1, expr2, len) \
STMT_BEGIN \
- const void *v1=(expr1), *v2=(expr2); \
- if (!memcmp(v1,v2,(len))) { printf("."); fflush(stdout); } else {\
+ const void *_test_v1=(expr1), *_test_v2=(expr2); \
+ if (!memcmp(_test_v1,_test_v2,(len))) { \
+ printf("."); fflush(stdout); } else { \
have_failed = 1; \
printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n", \
_SHORT_FILE_, \
@@ -138,8 +139,10 @@ extern int have_failed;
#define test_memneq(expr1, expr2, len) \
STMT_BEGIN \
- void *v1=(expr1), *v2=(expr2); \
- if (memcmp(v1,v2,(len))) { printf("."); fflush(stdout); } else {\
+ void *_test_v1=(expr1), *_test_v2=(expr2); \
+ if (memcmp(_test_v1,_test_v2,(len))) { \
+ printf("."); fflush(stdout); \
+ } else { \
have_failed = 1; \
printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n", \
_SHORT_FILE_, \