aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorarie <arie@alleycat.cc>2021-05-04 16:23:23 +0200
committerarie <arie@alleycat.cc>2021-05-04 16:23:23 +0200
commit6d4788d508b4fbb7fc01755b4413c77255fae001 (patch)
tree1923308e39294933c0cbc6292c6342ed5351d082 /test
parentfc0f68f94b1a22e53931670610c4570bbaa9fac6 (diff)
Rdf_json tests:
Add decode encode predicate test (still fails) Replace Iri by Uri Export some functions from rdf-json for testing.
Diffstat (limited to 'test')
-rw-r--r--test/json/main.ml26
1 files changed, 22 insertions, 4 deletions
diff --git a/test/json/main.ml b/test/json/main.ml
index 8e4a41c..c559036 100644
--- a/test/json/main.ml
+++ b/test/json/main.ml
@@ -1,4 +1,20 @@
-let _triple = Rdf_gen.triple
+
+let encode_decode_subject =
+ QCheck_alcotest.to_alcotest @@
+ QCheck.Test.make ~name:"decode encode subject"
+ Rdf_gen.subject
+ (fun subject ->
+ subject = (Rdf_json.encode_subject subject
+ |> Rdf_json.decode_subject))
+
+let encode_decode_predicate =
+ QCheck_alcotest.to_alcotest @@
+ QCheck.Test.make ~name:"decode encode predicate"
+ Rdf_gen.predicate
+ (fun predicate ->
+ predicate = (Rdf_json.encode_predicate predicate
+ |> Rdf_json.decode_predicate))
+
let encode_decode_triple_test =
QCheck_alcotest.to_alcotest @@
@@ -6,9 +22,9 @@ let encode_decode_triple_test =
Rdf_gen.triple
(fun triple ->
[triple] = (Rdf_json.encode [triple]
- |> Rdf_json.decode))
+ |> Rdf_json.decode))
-let encode_decode_triple_list_test =
+let _encode_decode_triple_list_test =
let triple_list_arbitrary =
Rdf_gen.triple
|> QCheck.list
@@ -26,7 +42,9 @@ let () =
Alcotest.run "Json" [
"Encoder", [
(* encode_decode_triple_list_test; *)
- encode_decode_triple_test;
+(* encode_decode_triple_test; *)
+(* encode_decode_subject; *)
+ encode_decode_predicate;
]
]