Many minor fixes, changes and first attempt of codecov
Changes on assert.h, foreach.h, test.h and timer.h Updated benchmarks, examples and tests Updated tests/Makefile for future Added list.c test Added CMC namespace to CONCATC and CONCATH on macro_collections.h
This commit is contained in:
1 parent
1edb12a83c
commit
7b349ea426
15 files changed
+1009
-742
No files matched your search
@@ -11,22 +11,22 @@
|
||||
#ifndef CMC_MACRO_COLLECTIONS
|
||||
#define CMC_MACRO_COLLECTIONS
|
||||
|
||||
#define CONCATH_(C) C##_WRAPGEN_HEADER
|
||||
#define CONCATC_(C) C##_WRAPGEN_SOURCE
|
||||
#define CMC_CONCATH_(C) C##_WRAPGEN_HEADER
|
||||
#define CMC_CONCATC_(C) C##_WRAPGEN_SOURCE
|
||||
|
||||
#define CONCATH(C) CONCATH_(C)
|
||||
#define CONCATC(C) CONCATC_(C)
|
||||
#define CMC_CONCATH(C) CMC_CONCATH_(C)
|
||||
#define CMC_CONCATC(C) CMC_CONCATC_(C)
|
||||
|
||||
#define COLLECTION_GENERATE(C, PFX, SNAME, FMOD, K, V) \
|
||||
COLLECTION_GENERATE_HEADER(C, PFX, SNAME, FMOD, K, V) \
|
||||
COLLECTION_GENERATE_SOURCE(C, PFX, SNAME, FMOD, K, V)
|
||||
|
||||
#define COLLECTION_GENERATE_HEADER(C, PFX, SNAME, FMOD, K, V) \
|
||||
CONCATH(C) \
|
||||
CMC_CONCATH(C) \
|
||||
(PFX, SNAME, FMOD, K, V)
|
||||
|
||||
#define COLLECTION_GENERATE_SOURCE(C, PFX, SNAME, FMOD, K, V) \
|
||||
CONCATC(C) \
|
||||
CMC_CONCATC(C) \
|
||||
(PFX, SNAME, FMOD, K, V)
|
||||
|
||||
#include "cmc/deque.h"
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "sac/queue.h"
|
||||
#include "sac/stack.h"
|
||||
|
||||
#include "utl/assert.h"
|
||||
#include "utl/foreach.h"
|
||||
#include "utl/log.h"
|
||||
#include "utl/test.h"
|
||||
|
||||
+682
-665
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -24,7 +24,7 @@
|
||||
{ \
|
||||
BODY; \
|
||||
} \
|
||||
} while (0);
|
||||
} while (0)
|
||||
|
||||
#define FOR_EACH_REV(PFX, SNAME, TARGET, BODY) \
|
||||
do \
|
||||
@@ -33,6 +33,6 @@
|
||||
{ \
|
||||
BODY; \
|
||||
} \
|
||||
} while (0);
|
||||
} while (0)
|
||||
|
||||
#endif /* CMC_FOR_EACH */
|
||||
+4
-4
@@ -103,10 +103,10 @@ static void cmc_test_log(const char *unit_name, const char *current_test, bool a
|
||||
tinfo.verbose = VERBOSE; \
|
||||
\
|
||||
/* Tests */ \
|
||||
TIMER_START(timer); \
|
||||
timer_start(timer); \
|
||||
BODY; \
|
||||
TIMER_STOP(timer); \
|
||||
TIMER_CALC(timer); \
|
||||
timer_stop(timer); \
|
||||
timer_calc(timer); \
|
||||
\
|
||||
unittest_abort: \
|
||||
if (tinfo.aborted) \
|
||||
@@ -133,7 +133,7 @@ static void cmc_test_log(const char *unit_name, const char *current_test, bool a
|
||||
\
|
||||
BODY; \
|
||||
\
|
||||
} while (0);
|
||||
} while (0)
|
||||
|
||||
#define CMC_TEST_PASS() \
|
||||
do \
|
||||
|
||||
+19
-6
@@ -22,13 +22,26 @@ typedef struct timer_s
|
||||
double result;
|
||||
} timer_t;
|
||||
|
||||
#define TIMER_START(timer) \
|
||||
timer.start = clock();
|
||||
#define timer_start(timer) \
|
||||
do \
|
||||
{ \
|
||||
(timer).start = clock(); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
#define TIMER_STOP(timer) \
|
||||
timer.stop = clock();
|
||||
#define timer_stop(timer) \
|
||||
do \
|
||||
{ \
|
||||
(timer).stop = clock(); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
#define TIMER_CALC(timer) \
|
||||
timer.result = (double)(((timer.stop - timer.start) * 1000.0) / CLOCKS_PER_SEC);
|
||||
#define timer_calc(timer) \
|
||||
do \
|
||||
{ \
|
||||
timer_t *t = &(timer); \
|
||||
t->result = (double)(t->stop - t->start) * 1000.0 / CLOCKS_PER_SEC; \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
#endif /* CMC_TIMER_H */
|
||||
Reference in new issue
Block a user