|
@@ -1,6 +1,3 @@
|
|
-#include <stdio.h>
|
|
|
|
-#include <stdlib.h>
|
|
|
|
-
|
|
|
|
#include "test.h"
|
|
#include "test.h"
|
|
#include "store_mdb.h"
|
|
#include "store_mdb.h"
|
|
#include "assets.h"
|
|
#include "assets.h"
|
|
@@ -13,10 +10,12 @@ static void rmdb() {
|
|
char data_path[32], lock_path[32];
|
|
char data_path[32], lock_path[32];
|
|
sprintf(data_path, "%s/data.mdb", path);
|
|
sprintf(data_path, "%s/data.mdb", path);
|
|
sprintf(lock_path, "%s/lock.mdb", path);
|
|
sprintf(lock_path, "%s/lock.mdb", path);
|
|
|
|
+
|
|
printf("Removing %s\n", data_path);
|
|
printf("Removing %s\n", data_path);
|
|
remove(data_path);
|
|
remove(data_path);
|
|
printf("Removing %s\n", lock_path);
|
|
printf("Removing %s\n", lock_path);
|
|
remove(lock_path);
|
|
remove(lock_path);
|
|
|
|
+ printf("Removing %s\n", path);
|
|
remove(path);
|
|
remove(path);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -71,8 +70,12 @@ static int test_quad_store()
|
|
rmdb();
|
|
rmdb();
|
|
EXPECT_PASS(LSUP_store_setup(&path));
|
|
EXPECT_PASS(LSUP_store_setup(&path));
|
|
|
|
|
|
|
|
+ LSUP_Term *ctx1 = LSUP_uri_new("urn:c:1");
|
|
|
|
+ LSUP_SerTerm sc1_s;
|
|
|
|
+ LSUP_term_serialize(ctx1, &sc1_s);
|
|
|
|
+
|
|
LSUP_MDBStore *store;
|
|
LSUP_MDBStore *store;
|
|
- store = LSUP_store_new(path, NULL); // triple store.
|
|
|
|
|
|
+ store = LSUP_store_new(path, &sc1_s); // triple store.
|
|
ASSERT(store != NULL, "Error initializing store!");
|
|
ASSERT(store != NULL, "Error initializing store!");
|
|
|
|
|
|
LSUP_Triple *trp = create_triples();
|
|
LSUP_Triple *trp = create_triples();
|
|
@@ -90,16 +93,14 @@ static int test_quad_store()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- LSUP_Term *ctx1 = LSUP_uri_new("urn:c:1");
|
|
|
|
- LSUP_SerTerm sc1_s;
|
|
|
|
- LSUP_term_serialize(ctx1, &sc1_s);
|
|
|
|
-
|
|
|
|
- EXPECT_PASS(LSUP_store_add(store, &sc1_s, ser_trp, NUM_TRP));
|
|
|
|
|
|
+ // Use store default context.
|
|
|
|
+ EXPECT_PASS(LSUP_store_add(store, NULL, ser_trp, NUM_TRP));
|
|
|
|
|
|
LSUP_Term *ctx2 = LSUP_uri_new("urn:c:2");
|
|
LSUP_Term *ctx2 = LSUP_uri_new("urn:c:2");
|
|
LSUP_SerTerm sc2_s;
|
|
LSUP_SerTerm sc2_s;
|
|
LSUP_term_serialize(ctx2, &sc2_s);
|
|
LSUP_term_serialize(ctx2, &sc2_s);
|
|
|
|
|
|
|
|
+ // Use specific context.
|
|
EXPECT_PASS(LSUP_store_add(store, &sc2_s, ser_trp, NUM_TRP));
|
|
EXPECT_PASS(LSUP_store_add(store, &sc2_s, ser_trp, NUM_TRP));
|
|
|
|
|
|
for (int i = 0; i < NUM_TRP; i++) {
|
|
for (int i = 0; i < NUM_TRP; i++) {
|
|
@@ -108,9 +109,14 @@ static int test_quad_store()
|
|
LSUP_buffer_done(ser_trp[i].o);
|
|
LSUP_buffer_done(ser_trp[i].o);
|
|
}
|
|
}
|
|
|
|
|
|
- LSUP_store_free(store);
|
|
|
|
|
|
+ LSUP_term_free(ctx1);
|
|
|
|
+ LSUP_term_free(ctx2);
|
|
|
|
+ LSUP_buffer_done(&sc1_s);
|
|
|
|
+ LSUP_buffer_done(&sc2_s);
|
|
free_triples(trp);
|
|
free_triples(trp);
|
|
|
|
|
|
|
|
+ LSUP_store_free(store);
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|