test_store_mdb.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "test.h"
  2. #include "store_mdb.h"
  3. #include "assets.h"
  4. static int test_triple_store()
  5. {
  6. char *path = "/tmp/testdb";
  7. EXPECT_PASS(LSUP_store_setup(&path));
  8. LSUP_MDBStore *store;
  9. store = LSUP_store_init(path, NULL); // triple store.
  10. ASSERT(store != NULL, "Error initializing store!");
  11. LSUP_Triple *trp = create_triples();
  12. LSUP_SerTerm sterms[NUM_TRP][3];
  13. LSUP_SerTriple ser_trp[NUM_TRP];
  14. for (int i = 0; i < NUM_TRP; i++) {
  15. ser_trp[i].s = sterms[i];
  16. ser_trp[i].p = sterms[i] + 1;
  17. ser_trp[i].o = sterms[i] + 2;
  18. for (int j = 0; j < 3; j++) {
  19. LSUP_term_serialize(
  20. LSUP_triple_term_by_pos(trp + i, j),
  21. LSUP_ser_triple_term_by_pos(ser_trp + i, j));
  22. }
  23. }
  24. EXPECT_PASS(LSUP_store_add(store, NULL, ser_trp, NUM_TRP));
  25. LSUP_store_done(store);
  26. free_triples(trp);
  27. return 0;
  28. }
  29. static int test_quad_store()
  30. {
  31. return 0;
  32. }
  33. int store_mdb_test()
  34. {
  35. RUN(test_triple_store);
  36. RUN(test_quad_store);
  37. return 0;
  38. }