test.c 981 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "test_term.c"
  2. #include "test_namespace.c"
  3. #include "test_codec_nt.c"
  4. #include "test_store_ht.c"
  5. #include "test_store_mdb.c"
  6. #include "test_graph.c"
  7. #define TEST_STORE_PATH TMPDIR "/lsup_test_mdb"
  8. int main(int argc, char **argv) {
  9. // Set env variable to test path.
  10. putenv ("LSUP_MDB_STORE_PATH=" TEST_STORE_PATH);
  11. // Clear out database from previous test.
  12. rm_r (TEST_STORE_PATH);
  13. int rc = LSUP_init();
  14. if (rc != LSUP_OK) return rc;
  15. if (
  16. term_tests() ||
  17. namespace_tests() ||
  18. store_ht_tests() ||
  19. store_mdb_tests() ||
  20. graph_tests() ||
  21. codec_nt_tests() ||
  22. 0
  23. ) {
  24. log_error ("Test failed.");
  25. rc = -1;
  26. } else {
  27. log_info ("");
  28. log_info ("********************");
  29. log_info ("* ALL TESTS PASSED *");
  30. log_info ("********************");
  31. rc = 0;
  32. }
  33. log_info ("");
  34. log_info ("Tests run: %d", tests_run);
  35. return rc;
  36. }