test.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <time.h>
  2. #include "test_term.c"
  3. #include "test_namespace.c"
  4. #include "test_codec_nt.c"
  5. #include "test_codec_ttl.c"
  6. #include "test_store.c"
  7. #include "test_store_mdb.c"
  8. #include "test_graph.c"
  9. #define TEST_STORE_PATH TMPDIR "/volksdata_test_mdb"
  10. int main() {
  11. // Set env variable to test path.
  12. // Clear out database from previous test.
  13. clock_t start, end;
  14. double wallclock;
  15. start = clock();
  16. VOLK_rc rc = VOLK_init();
  17. RCCK (rc);
  18. if (
  19. term_tests() ||
  20. namespace_tests() ||
  21. store_tests() ||
  22. store_mdb_tests() ||
  23. graph_tests() ||
  24. codec_nt_tests() ||
  25. codec_ttl_tests() ||
  26. 0
  27. ) {
  28. log_error ("Test failed.");
  29. rc = VOLK_ERROR;
  30. } else {
  31. log_info ("");
  32. log_info ("********************");
  33. log_info ("* ALL TESTS PASSED *");
  34. log_info ("********************");
  35. rc = VOLK_OK;
  36. }
  37. end = clock();
  38. wallclock = (end - start) * 1000 / CLOCKS_PER_SEC;
  39. log_info ("");
  40. log_info ("Run %d tests in %lu ms.", tests_run, (size_t) wallclock);
  41. return (int)rc;
  42. }