Working on http body code

This commit is contained in:
2014-08-27 23:12:41 +01:00
parent 053a6a8e21
commit e15e94dad2
11 changed files with 650 additions and 112 deletions

64
tests/minunit.h Normal file
View File

@@ -0,0 +1,64 @@
/*
* File: minunit.h
* Author: Zed. A. Shaw, Sam
*
* @see http://c.learncodethehardway.org/book/ex30.html
*
* Created on 27 August 2014, 22:14
*/
#ifndef MINUNIT_H
#define MINUNIT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#define log_err(message) printf("\tError: %s\n", message)
#define mu_suite_start() char *message = NULL
#define mu_assert(test, message) \
do { \
if (!(test)) { \
log_err(message); \
return message; \
} \
} while(0)
#define mu_run_test(test) \
do { \
printf("\n-----%s", " " #test); \
message = test(); \
tests_run++; \
if (message) { return message; } \
while(0)
#define RUN_TESTS(name) \
int main(int argc, char *argv[]) { \
tests_run = 0; \
argc = 1; \
printf("----\nRUNNING: %s\n", argv[0]); \
char *result = name(); \
if (result != 0) { \
printf("FAILED: %s\n", result); \
} \
else { \
printf("ALL TESTS PASSED\n"); \
} \
printf("Tests run: %d\n", tests_run); \
exit(result == 0 ? EXIT_SUCCESS : EXIT_FAILURE);\
}
int tests_run;
#ifdef __cplusplus
}
#endif
#endif /* MINUNIT_H */