|
@@ -45,7 +45,7 @@ _graph_add (LSUP_StoreType type)
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
|
|
- LSUP_Triple *trp = create_triples();
|
|
|
|
|
|
+ LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store;
|
|
LSUP_Store *store;
|
|
@@ -65,10 +65,11 @@ _graph_add (LSUP_StoreType type)
|
|
|
|
|
|
for (int i = 0; i < sizeof (trp); i++) {
|
|
for (int i = 0; i < sizeof (trp); i++) {
|
|
log_info ("checking triple #%d.", i);
|
|
log_info ("checking triple #%d.", i);
|
|
- ASSERT (LSUP_graph_contains (gr, trp + i), "Triple not in graph!");
|
|
|
|
|
|
+ ASSERT (LSUP_graph_contains (gr, trp[i]), "Triple not in graph!");
|
|
}
|
|
}
|
|
|
|
|
|
- LSUP_Triple *missing_trp = LSUP_triple_new (trp[1].s, trp[6].p, trp[4].o);
|
|
|
|
|
|
+ LSUP_Triple *missing_trp = LSUP_triple_new (
|
|
|
|
+ trp[1]->s, trp[6]->p, trp[4]->o);
|
|
ASSERT (! LSUP_graph_contains (gr, missing_trp), "Triple in graph!");
|
|
ASSERT (! LSUP_graph_contains (gr, missing_trp), "Triple in graph!");
|
|
free (missing_trp);
|
|
free (missing_trp);
|
|
|
|
|
|
@@ -85,23 +86,23 @@ static int
|
|
_graph_lookup (LSUP_StoreType type)
|
|
_graph_lookup (LSUP_StoreType type)
|
|
{
|
|
{
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
- LSUP_Triple *trp = create_triples();
|
|
|
|
|
|
+ LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
// Lookup triples.
|
|
// Lookup triples.
|
|
LSUP_Term *lu_trp[N_LUT][3] = {
|
|
LSUP_Term *lu_trp[N_LUT][3] = {
|
|
{NULL, NULL, NULL}, // 8 matches
|
|
{NULL, NULL, NULL}, // 8 matches
|
|
- {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
|
|
|
|
|
|
+ {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.
|
|
// Lookup result counts.
|
|
@@ -198,7 +199,7 @@ _graph_remove (LSUP_StoreType type)
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
const LSUP_StoreInt *sif = LSUP_store_int (type);
|
|
if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
|
|
- LSUP_Triple *trp = create_triples();
|
|
|
|
|
|
+ LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store;
|
|
LSUP_Store *store;
|
|
@@ -216,18 +217,18 @@ _graph_remove (LSUP_StoreType type)
|
|
EXPECT_INT_EQ (LSUP_graph_size (gr), 8);
|
|
EXPECT_INT_EQ (LSUP_graph_size (gr), 8);
|
|
|
|
|
|
// Triples 0, 3, 4, 5, 7 will be removed.
|
|
// Triples 0, 3, 4, 5, 7 will be removed.
|
|
- LSUP_graph_remove (gr, trp[0].s, NULL, NULL, &ct);
|
|
|
|
|
|
+ LSUP_graph_remove (gr, trp[0]->s, NULL, NULL, &ct);
|
|
EXPECT_INT_EQ (ct, 5);
|
|
EXPECT_INT_EQ (ct, 5);
|
|
EXPECT_INT_EQ (LSUP_graph_size (gr), 3);
|
|
EXPECT_INT_EQ (LSUP_graph_size (gr), 3);
|
|
|
|
|
|
- ASSERT (!LSUP_graph_contains (gr, trp + 0), "Unexpected triple found!");
|
|
|
|
- ASSERT (LSUP_graph_contains (gr, trp + 1), "Triple not in graph!");
|
|
|
|
- ASSERT (LSUP_graph_contains (gr, trp + 2), "Triple not in graph!");
|
|
|
|
- ASSERT (!LSUP_graph_contains (gr, trp + 3), "Unexpected triple found!");
|
|
|
|
- ASSERT (!LSUP_graph_contains (gr, trp + 4), "Unexpected triple found!");
|
|
|
|
- ASSERT (!LSUP_graph_contains (gr, trp + 5), "Unexpected triple found!");
|
|
|
|
- ASSERT (LSUP_graph_contains (gr, trp + 6), "Triple not in graph!");
|
|
|
|
- ASSERT (!LSUP_graph_contains (gr, trp + 7), "Unexpected triple found!");
|
|
|
|
|
|
+ ASSERT (!LSUP_graph_contains (gr, trp[0]), "Unexpected triple found!");
|
|
|
|
+ ASSERT (LSUP_graph_contains (gr, trp[1]), "Triple not in graph!");
|
|
|
|
+ ASSERT (LSUP_graph_contains (gr, trp[2]), "Triple not in graph!");
|
|
|
|
+ ASSERT (!LSUP_graph_contains (gr, trp[3]), "Unexpected triple found!");
|
|
|
|
+ ASSERT (!LSUP_graph_contains (gr, trp[4]), "Unexpected triple found!");
|
|
|
|
+ ASSERT (!LSUP_graph_contains (gr, trp[5]), "Unexpected triple found!");
|
|
|
|
+ ASSERT (LSUP_graph_contains (gr, trp[6]), "Triple not in graph!");
|
|
|
|
+ ASSERT (!LSUP_graph_contains (gr, trp[7]), "Unexpected triple found!");
|
|
|
|
|
|
free_triples (trp); // gr copied data.
|
|
free_triples (trp); // gr copied data.
|
|
|
|
|
|
@@ -249,7 +250,7 @@ _graph_txn (LSUP_StoreType type)
|
|
|
|
|
|
if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
if (sif->setup_fn) sif->setup_fn (NULL, true);
|
|
|
|
|
|
- LSUP_Triple *trp = create_triples();
|
|
|
|
|
|
+ LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr;
|
|
LSUP_Graph *gr;
|
|
LSUP_Store *store =
|
|
LSUP_Store *store =
|
|
@@ -365,7 +366,7 @@ BACKEND_TBL
|
|
|
|
|
|
static int test_graph_copy()
|
|
static int test_graph_copy()
|
|
{
|
|
{
|
|
- LSUP_Triple *trp = create_triples();
|
|
|
|
|
|
+ LSUP_Triple **trp = create_triples();
|
|
|
|
|
|
LSUP_Graph *gr1 = LSUP_graph_new (NULL, NULL, NULL);
|
|
LSUP_Graph *gr1 = LSUP_graph_new (NULL, NULL, NULL);
|
|
ASSERT (gr1 != NULL, "Error creating graph!");
|
|
ASSERT (gr1 != NULL, "Error creating graph!");
|
|
@@ -380,7 +381,7 @@ static int test_graph_copy()
|
|
for (int i = 0; i < sizeof (trp); i++) {
|
|
for (int i = 0; i < sizeof (trp); i++) {
|
|
log_info ("checking triple #%d.", i);
|
|
log_info ("checking triple #%d.", i);
|
|
ASSERT (
|
|
ASSERT (
|
|
- LSUP_graph_contains (gr2, trp + i),
|
|
|
|
|
|
+ LSUP_graph_contains (gr2, trp[i]),
|
|
"Triple not in copied graph!");
|
|
"Triple not in copied graph!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -392,7 +393,7 @@ static int test_graph_copy()
|
|
for (int i = 0; i < sizeof (trp); i++) {
|
|
for (int i = 0; i < sizeof (trp); i++) {
|
|
log_info ("checking triple #%d.", i);
|
|
log_info ("checking triple #%d.", i);
|
|
ASSERT (
|
|
ASSERT (
|
|
- LSUP_graph_contains (gr3, trp + i),
|
|
|
|
|
|
+ LSUP_graph_contains (gr3, trp[i]),
|
|
"Triple not in copied graph!");
|
|
"Triple not in copied graph!");
|
|
}
|
|
}
|
|
|
|
|