Permalink
Browse files

update tests to use harness in ext/ct-head, remove obsolete files

  • Loading branch information...
postspectacular committed Aug 13, 2016
1 parent 32c4f9c commit 2847b961954e83048669151ae546197b95c77f73
Showing with 23 additions and 66 deletions.
  1. +1 −1 ext/ct-head
  2. +2 −2 premake5.lua
  3. +0 −4 src/test/test.c
  4. +0 −39 src/test/test.h
  5. +1 −1 test/adjacency.c
  6. +1 −1 test/circle.c
  7. +1 −1 test/clip.c
  8. +1 −1 test/cons.c
  9. +1 −1 test/consrc.c
  10. +1 −1 test/hash.c
  11. +1 −1 test/hashset.c
  12. +1 −1 test/hashtable.c
  13. +1 −1 test/hull.c
  14. +1 −1 test/main.c
  15. +1 −1 test/matrix.c
  16. +1 −1 test/mpool.c
  17. +1 −1 test/octree.c
  18. +1 −1 test/poisson.c
  19. +1 −1 test/quadtree.c
  20. +1 −1 test/random.c
  21. +1 −1 test/soa.c
  22. +1 −1 test/spatialgrid.c
  23. +1 −1 test/vec.c
  24. +1 −1 test/vector.c
Submodule ct-head updated 2 files
+4 −0 test.c
+42 −0 test.h
View
@@ -22,7 +22,7 @@ optimize "Size"
project "test"
kind "ConsoleApp"
-files { "src/test/**.c", "test/**.c" }
+files { "ext/**.c", "test/**.c" }
defines { "CT_FEATURE_ANSI" }
links "lib"
dependson "lib"
@@ -32,7 +32,7 @@ flags { "FatalWarnings", "LinkTimeOptimization" }
project "test_asan"
kind "ConsoleApp"
-files { "src/test/**.c", "test/**.c" }
+files { "ext/**.c", "test/**.c" }
defines { "CT_FEATURE_ANSI", "CT_FEATURE_CHECKS", "CT_FEATURE_CHECK_MEM" }
links "lib"
dependson "lib"
View
@@ -1,4 +0,0 @@
-#include <stddef.h>
-
-size_t __testsRun = 0;
-size_t __testAsserts = 0;
View
@@ -1,39 +0,0 @@
-#pragma once
-
-#include "cthing.h"
-
-#define CT_TEST_DECLS \
- extern size_t __testsRun; \
- extern size_t __testAsserts;
-
-#define CT_IS(test, message, ...) \
- __testAsserts++; \
- if (!(test)) { \
- CT_ERROR(message, ##__VA_ARGS__); \
- return 1; \
- }
-
-#define CT_RUN_TEST(test) \
- CT_INFO("----- %s -----", "" #test); \
- do { \
- size_t t = __testAsserts; \
- clock_t begin = clock(); \
- int res = test(); \
- double measured = (double)(clock() - begin) / CLOCKS_PER_SEC * 1000.0; \
- CT_INFO("%zu assertions (%1.3fms)", __testAsserts - t, measured); \
- __testsRun++; \
- if (res) { \
- return res; \
- } \
- } while (0);
-
-#define CT_RUN_TESTS(name) \
- int main() { \
- CT_INFO("----- RUN TESTS: %s -----", "" #name); \
- int result = name(); \
- CT_INFO("Tests run: %zu, total asserts: %zu", __testsRun, __testAsserts); \
- if (!result) { \
- CT_SUCCESS("ALL TESTS PASSED"); \
- } \
- return result; \
- }
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/adjacency.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "geom/circle.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "geom/clip/liangbarsky.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/cons.h"
#include "mem/mpool.h"
View
@@ -1,6 +1,6 @@
#include <string.h>
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/consrc.h"
#include "data/object.h"
View
@@ -1,6 +1,6 @@
#include <string.h>
-#include "test/test.h"
+#include "ct-head/test.h"
#include "math/hashfn.h"
View
@@ -1,6 +1,6 @@
#include <string.h>
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/hashset.h"
#include "math/hashfn.h"
View
@@ -1,6 +1,6 @@
#include <string.h>
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/hashtable.h"
#include "math/hashfn.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "geom/hull.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
extern int test_mpool();
extern int test_mpool_resize();
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/array.h"
#include "math/matrix.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "mem/mpool.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/octree.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "math/poisson.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/quadtree.h"
#include "geom/isec.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "math/random.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/array.h"
#include "data/soa.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/spatialgrid.h"
#include "math/vec.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/array.h"
#include "math/vec.h"
View
@@ -1,4 +1,4 @@
-#include "test/test.h"
+#include "ct-head/test.h"
#include "data/vector.h"

0 comments on commit 2847b96

Please sign in to comment.