#include "test.h" #include "namespace.h" static int test_desc_create() { LSUP_Term *terms1[] = { LSUP_iriref_new ("urn:s:1", NULL), LSUP_iriref_new ("urn:s:2", NULL), LSUP_iriref_new ("urn:p:1", NULL), LSUP_iriref_new ("urn:p:2", NULL), LSUP_iriref_new ("urn:o:1", NULL), LSUP_iriref_new ("urn:o:2", NULL), }; LSUP_Term *terms2[] = { LSUP_iriref_new ("urn:s:10", NULL), LSUP_iriref_new ("urn:s:20", NULL), LSUP_iriref_new ("urn:p:10", NULL), LSUP_iriref_new ("urn:p:20", NULL), LSUP_iriref_new ("urn:o:10", NULL), LSUP_iriref_new ("urn:o:20", NULL), }; LSUP_Triple *trp1[] = { LSUP_triple_new (terms1[0], terms1[2], terms1[4]), LSUP_triple_new (terms1[0], terms1[3], terms1[4]), LSUP_triple_new (terms1[0], terms1[3], terms1[5]), LSUP_triple_new (terms1[1], terms1[2], terms1[4]), NULL }; LSUP_Triple *trp2[] = { LSUP_triple_new (terms2[0], terms2[2], terms2[4]), LSUP_triple_new (terms2[0], terms2[3], terms2[4]), LSUP_triple_new (terms2[0], terms2[3], terms2[5]), LSUP_triple_new (terms2[1], terms2[2], terms2[4]), NULL }; LSUP_Term *usr1_uri = LSUP_iriref_new ("#usr1", NULL); LSUP_Graph *gr1 = LSUP_graph_new (NULL, usr1_uri, NULL); LSUP_term_free (usr1_uri); ASSERT (gr1, "Error creating graph!"); EXPECT_PASS (LSUP_graph_add (gr1, trp1, NULL)); for (size_t i = 0; trp1[i]; i++) free (trp1[i]); LSUP_Term *usr2_uri = LSUP_iriref_new ("#usr2", NULL); LSUP_Graph *gr2 = LSUP_graph_new (NULL, usr2_uri, NULL); LSUP_term_free (usr2_uri); ASSERT (gr2, "Error creating graph!"); EXPECT_PASS (LSUP_graph_add (gr2, trp2, NULL)); for (size_t i = 0; trp2[i]; i++) free (trp2[i]); LSUP_Graph *data[] = {gr1, gr2, NULL}; LSR_Desc *rsrc; EXPECT_PASS (LSR_desc_new_multi (data, &rsrc)); // Free input handles before using the resource to ensure that these // pointers are not being referenced by the resource. LSUP_graph_free (gr1); LSUP_graph_free (gr2); for (int i = 0; i < 6; i++) { LSUP_term_free (terms1[i]); LSUP_term_free (terms2[i]); } // TODO more action // Store for next test before freeing. EXPECT_PASS (LSR_desc_store (rsrc)); LSR_desc_free (rsrc); return 0; } static int test_desc_get () { return 0; } int desc_tests() { RUN (test_desc_create); RUN (test_desc_get); return 0; }