aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlleyCat <info@alleycat.cc>2021-05-05 17:03:12 +0200
committerAlleyCat <info@alleycat.cc>2021-05-05 17:03:12 +0200
commit03a6d544cba33f2a7be45b3ddded606bf3dc84f3 (patch)
treef1efa68e23dfbd9ef09983111b38789b847da430 /test
parent6d4788d508b4fbb7fc01755b4413c77255fae001 (diff)
Rdf_json tests:
add equality functions for subjects, predicates and objects. Include tests for encode / decode tests for subjects, predicates and objects
Diffstat (limited to 'test')
-rw-r--r--test/json/main.ml27
1 files changed, 16 insertions, 11 deletions
diff --git a/test/json/main.ml b/test/json/main.ml
index c559036..8e116cd 100644
--- a/test/json/main.ml
+++ b/test/json/main.ml
@@ -1,23 +1,27 @@
+module Triple = Rdf.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))
+ (fun subject -> Triple.Subject.equal
+ subject
+ (subject |> Rdf_json.encode_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))
+ (fun predicate -> Triple.Predicate.equal
+ predicate
+ (predicate |> Rdf_json.encode_predicate |> Rdf_json.decode_predicate))
+let encode_decode_object =
+ QCheck.Test.make ~name:"decode encode object"
+ Rdf_gen.object'
+ (fun object' -> Triple.Object.equal
+ object'
+ (object' |> Rdf_json.encode_object |> Rdf_json.decode_object))
let encode_decode_triple_test =
- QCheck_alcotest.to_alcotest @@
QCheck.Test.make ~name:"decode encode"
Rdf_gen.triple
(fun triple ->
@@ -40,11 +44,12 @@ let _encode_decode_triple_list_test =
let () =
Alcotest.run "Json" [
- "Encoder", [
+ "Encoder", List.map QCheck_alcotest.to_alcotest [
(* encode_decode_triple_list_test; *)
(* encode_decode_triple_test; *)
-(* encode_decode_subject; *)
+ encode_decode_subject;
encode_decode_predicate;
+ encode_decode_object;
]
]