|
@@ -63,19 +63,19 @@ _graph_lookup (LSUP_store_type type)
|
|
|
LSUP_Triple *trp = create_triples();
|
|
|
|
|
|
// Lookup triples.
|
|
|
- LSUP_Triple *lu_trp[N_LUT] = {
|
|
|
- LSUP_triple_new (trp[0].s, NULL, NULL), // 5 matches
|
|
|
- LSUP_triple_new (NULL, trp[2].p, NULL), // 3 matches
|
|
|
- LSUP_triple_new (NULL, NULL, trp[5].o), // 2 matches
|
|
|
- LSUP_triple_new (trp[0].s, trp[0].p, NULL), // 1 match
|
|
|
- LSUP_triple_new (NULL, trp[0].p, trp[0].o), // 1 match
|
|
|
- LSUP_triple_new (trp[0].s, trp[2].p, trp[5].o), // 1 match
|
|
|
- LSUP_triple_new (trp[0].p, NULL, NULL), // 0 matches
|
|
|
- LSUP_triple_new (NULL, trp[2].s, NULL), // 0 matches
|
|
|
- LSUP_triple_new (NULL, NULL, trp[5].p), // 0 matches
|
|
|
- LSUP_triple_new (trp[2].s, trp[6].p, NULL), // 0 matches
|
|
|
- LSUP_triple_new (NULL, trp[1].p, trp[5].o), // 0 matches
|
|
|
- LSUP_triple_new (trp[2].s, trp[2].p, trp[5].o), // 0 matches
|
|
|
+ LSUP_Term *lu_trp[N_LUT][3] = {
|
|
|
+ {trp[0].s, NULL, NULL}, // 5 matches
|
|
|
+ {NULL, trp[2].p, NULL}, // 3 matches
|
|
|
+ {NULL, NULL, trp[5].o}, // 2 matches
|
|
|
+ {trp[0].s, trp[0].p, NULL}, // 1 match
|
|
|
+ {NULL, trp[0].p, trp[0].o}, // 1 match
|
|
|
+ {trp[0].s, trp[2].p, trp[5].o}, // 1 match
|
|
|
+ {trp[0].p, NULL, NULL}, // 0 matches
|
|
|
+ {NULL, trp[2].s, NULL}, // 0 matches
|
|
|
+ {NULL, NULL, trp[5].p}, // 0 matches
|
|
|
+ {trp[2].s, trp[6].p, NULL}, // 0 matches
|
|
|
+ {NULL, trp[1].p, trp[5].o}, // 0 matches
|
|
|
+ {trp[2].s, trp[2].p, trp[5].o}, // 0 matches
|
|
|
};
|
|
|
|
|
|
// Lookup result counts.
|
|
@@ -115,8 +115,8 @@ _graph_lookup (LSUP_store_type type)
|
|
|
|
|
|
for (int i = 0; i < N_LUT; i++) {
|
|
|
printf ("Checking tiple #%d on %d... ", i, type);
|
|
|
- spo = lu_trp[i];
|
|
|
- LSUP_GraphIterator *it = LSUP_graph_lookup (gr, spo, &ct);
|
|
|
+ LSUP_GraphIterator *it = LSUP_graph_lookup (
|
|
|
+ gr, lu_trp[i][0], lu_trp[i][1], lu_trp[i][2], &ct);
|
|
|
if (type != LSUP_STORE_MEM) // TODO not implemented in htable.
|
|
|
EXPECT_INT_EQ (ct, lu_ct[i]);
|
|
|
printf ("done.\n");
|
|
@@ -135,10 +135,7 @@ _graph_lookup (LSUP_store_type type)
|
|
|
LSUP_graph_iter_free (it);
|
|
|
};
|
|
|
|
|
|
- //LSUP_triple_free (spo);
|
|
|
- for (int i = 0; i < N_LUT; i++) free (lu_trp[i]);
|
|
|
free_triples (trp);
|
|
|
-
|
|
|
LSUP_graph_free (gr);
|
|
|
|
|
|
return 0;
|
|
@@ -158,8 +155,7 @@ _graph_remove (LSUP_store_type type)
|
|
|
EXPECT_INT_EQ (ct, 8);
|
|
|
EXPECT_INT_EQ (LSUP_graph_size (gr), 8);
|
|
|
|
|
|
- LSUP_Triple *spo = LSUP_triple_new (trp[0].s, NULL, NULL);
|
|
|
- LSUP_graph_remove (gr, spo, &ct);
|
|
|
+ LSUP_graph_remove (gr, trp[0].s, NULL, NULL, &ct);
|
|
|
|
|
|
ASSERT (!LSUP_graph_contains (gr, trp + 0), "Unexpected triple found!");
|
|
|
ASSERT (LSUP_graph_contains (gr, trp + 1), "Triple not in graph!");
|
|
@@ -171,7 +167,6 @@ _graph_remove (LSUP_store_type type)
|
|
|
ASSERT (!LSUP_graph_contains (gr, trp + 7), "Unexpected triple found!");
|
|
|
EXPECT_INT_EQ (LSUP_graph_size (gr), 3);
|
|
|
|
|
|
- free (spo);
|
|
|
free_triples (trp); // gr copied data.
|
|
|
|
|
|
LSUP_graph_free (gr);
|