123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #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[] = {
- {terms1[0], terms1[2], terms1[4]},
- {terms1[0], terms1[3], terms1[4]},
- {terms1[0], terms1[3], terms1[5]},
- {terms1[1], terms1[2], terms1[4]},
- {NULL}
- };
- LSUP_Triple trp2[] = {
- {terms2[0], terms2[2], terms2[4]},
- {terms2[0], terms2[3], terms2[4]},
- {terms2[0], terms2[3], terms2[5]},
- {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));
- 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));
- 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;
- }
|