test_desc.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "test.h"
  2. #include "namespace.h"
  3. static int
  4. test_desc_create()
  5. {
  6. char
  7. *ttl1 = "<urn:s:1> <urn:p:2> <urn:o:2> , <urn:o:1> ; "
  8. "<urn:p:1> <urn:o:1> . "
  9. "<urn:s:2> <urn:p:1> <urn:o:1> . ",
  10. *ttl2 = "<urn:s:20> <urn:p:10> <urn:o:10> . "
  11. "<urn:s:10> <urn:p:10> <urn:o:10> ; "
  12. "<urn:p:20> <urn:o:20> , <urn:o:10> . ";
  13. LSUP_Graph *data[3] = {NULL};
  14. FILE *input;
  15. char *err;
  16. size_t ct;
  17. input = fmemopen (ttl1, strlen (ttl1), "r");
  18. ttl_codec.decode_graph(input, data, &ct, &err);
  19. LSUP_graph_set_uri (data[0], LSUP_iriref_new ("#usr1", NULL));
  20. fclose(input);
  21. input = fmemopen (ttl2, strlen (ttl2), "r");
  22. ttl_codec.decode_graph(input, data + 1, &ct, &err);
  23. LSUP_graph_set_uri (data[1], LSUP_iriref_new ("#usr2", NULL));
  24. fclose(input);
  25. free(err);
  26. LSR_Desc *rsrc;
  27. EXPECT_PASS (LSR_desc_new_multi (data, &rsrc));
  28. // Free input handles before using the resource to ensure that these
  29. // pointers are not being referenced by the resource.
  30. LSUP_graph_free (data[0]);
  31. LSUP_graph_free (data[1]);
  32. // TODO tests:
  33. // * Existence of admin graph
  34. // * Existence of main graph
  35. // * Linkage of admin and main graphs
  36. // * Existence of user graphs
  37. // * Linkage of user graphs
  38. // * Size of user graphs
  39. // * Spot-test triples in user graphs
  40. // Store for next test before freeing.
  41. EXPECT_PASS (LSR_desc_store (rsrc));
  42. LSR_desc_free (rsrc);
  43. return 0;
  44. }
  45. static int
  46. test_desc_get ()
  47. {
  48. return 0;
  49. }
  50. int desc_tests()
  51. {
  52. RUN (test_desc_create);
  53. RUN (test_desc_get);
  54. return 0;
  55. }