diff options
author | Bertrand SIMONNET <bsimonnet@google.com> | 2015-07-01 15:39:44 -0700 |
---|---|---|
committer | Bertrand SIMONNET <bsimonnet@google.com> | 2015-07-08 10:51:12 -0700 |
commit | e6cd738ed3716c02557fb3a47515244e949ade39 (patch) | |
tree | 8d093306c27b850f828317ed67d6efea3ec7e084 /tests/unit/curlcheck.h | |
parent | d43abe883892fe84137052fd27ecd956a2c7cacf (diff) | |
download | android_external_curl-e6cd738ed3716c02557fb3a47515244e949ade39.tar.gz android_external_curl-e6cd738ed3716c02557fb3a47515244e949ade39.tar.bz2 android_external_curl-e6cd738ed3716c02557fb3a47515244e949ade39.zip |
Import curl 7.43
This is a simple import of curl 7.43.
The only change from the official release is the fact that the
Android.mk was removed to avoid build error trying to parse it.
BUG: 22347561
Change-Id: I52ef6798d30b25d22d1f62770d571adec8bcf4d5
Diffstat (limited to 'tests/unit/curlcheck.h')
-rw-r--r-- | tests/unit/curlcheck.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/tests/unit/curlcheck.h b/tests/unit/curlcheck.h new file mode 100644 index 0000000..2e3746b --- /dev/null +++ b/tests/unit/curlcheck.h @@ -0,0 +1,100 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "test.h" + +/* The fail macros mark the current test step as failed, and continue */ +#define fail_if(expr, msg) \ + if(expr) { \ + fprintf(stderr, "%s:%d Assertion '%s' met: %s\n" , \ + __FILE__, __LINE__, #expr, msg); \ + unitfail++; \ + } + +#define fail_unless(expr, msg) \ + if(!(expr)) { \ + fprintf(stderr, "%s:%d Assertion '%s' failed: %s\n", \ + __FILE__, __LINE__, #expr, msg); \ + unitfail++; \ + } + +#define verify_memory(dynamic, check, len) \ + if(dynamic && memcmp(dynamic, check, len)) { \ + fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \ + __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \ + fprintf(stderr, "%s:%d the same as '%s'\n", \ + __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \ + unitfail++; \ + } + +/* fail() is for when the test case figured out by itself that a check + proved a failure */ +#define fail(msg) do { \ + fprintf(stderr, "%s:%d test failed: '%s'\n", \ + __FILE__, __LINE__, msg); \ + unitfail++; \ + } WHILE_FALSE + + +/* The abort macros mark the current test step as failed, and exit the test */ +#define abort_if(expr, msg) \ + if(expr) { \ + fprintf(stderr, "%s:%d Abort assertion '%s' met: %s\n" , \ + __FILE__, __LINE__, #expr, msg); \ + unitfail++; \ + goto unit_test_abort; \ + } + +#define abort_unless(expr, msg) \ + if(!(expr)) { \ + fprintf(stderr, "%s:%d Abort assertion '%s' failed: %s\n", \ + __FILE__, __LINE__, #expr, msg); \ + unitfail++; \ + goto unit_test_abort; \ + } + +#define abort_test(msg) do { \ + fprintf(stderr, "%s:%d test aborted: '%s'\n", \ + __FILE__, __LINE__, msg); \ + unitfail++; \ + goto unit_test_abort; \ + } WHILE_FALSE + + + +extern int unitfail; + +#define UNITTEST_START \ + int test(char *arg) \ + { \ + (void)arg; \ + if (unit_setup()) { \ + fail("unit_setup() failure"); \ + } else { + +#define UNITTEST_STOP \ + goto unit_test_abort; /* avoid warning */ \ +unit_test_abort: \ + unit_stop(); \ + } \ + return unitfail; \ + } + |