mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 10:18:11 +08:00
Less verbose unit test
This commit is contained in:
parent
7923509d1e
commit
3774f676cf
@ -1496,13 +1496,13 @@ static void test_str(void) {
|
|||||||
{
|
{
|
||||||
char tmp[40];
|
char tmp[40];
|
||||||
#define DBLWIDTH(a, b) a, b
|
#define DBLWIDTH(a, b) a, b
|
||||||
#define TESTDOUBLE(fmt_, num_, res_) \
|
#define TESTDOUBLE(fmt_, num_, res_) \
|
||||||
do { \
|
do { \
|
||||||
const char *N = #num_; \
|
const char *N = #num_; \
|
||||||
size_t n = mg_snprintf(tmp, sizeof(tmp), fmt_, num_); \
|
size_t n = mg_snprintf(tmp, sizeof(tmp), fmt_, num_); \
|
||||||
printf("[%s] [%s] -> [%s] [%.*s]\n", fmt_, N, res_, (int) n, tmp); \
|
if (0) printf("[%s] [%s] -> [%s] [%.*s]\n", fmt_, N, res_, (int) n, tmp); \
|
||||||
ASSERT(n == strlen(res_)); \
|
ASSERT(n == strlen(res_)); \
|
||||||
ASSERT(strcmp(tmp, res_) == 0); \
|
ASSERT(strcmp(tmp, res_) == 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
TESTDOUBLE("%g", 0.0, "0");
|
TESTDOUBLE("%g", 0.0, "0");
|
||||||
@ -2062,7 +2062,7 @@ static void test_packed(void) {
|
|||||||
|
|
||||||
// Load top level file directly
|
// Load top level file directly
|
||||||
fetch(&mgr, buf, url, "GET /Makefile HTTP/1.0\n\n");
|
fetch(&mgr, buf, url, "GET /Makefile HTTP/1.0\n\n");
|
||||||
printf("---> %s\n", buf);
|
// printf("---> %s\n", buf);
|
||||||
ASSERT(fetch(&mgr, buf, url, "GET /Makefile HTTP/1.0\n\n") == 200);
|
ASSERT(fetch(&mgr, buf, url, "GET /Makefile HTTP/1.0\n\n") == 200);
|
||||||
ASSERT(cmpbody(buf, data) == 0);
|
ASSERT(cmpbody(buf, data) == 0);
|
||||||
free(data);
|
free(data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user