aboutsummaryrefslogtreecommitdiff
path: root/tests/analyser_dependency.ml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/analyser_dependency.ml')
-rw-r--r--tests/analyser_dependency.ml49
1 files changed, 26 insertions, 23 deletions
diff --git a/tests/analyser_dependency.ml b/tests/analyser_dependency.ml
index 279b5e5..8409d73 100644
--- a/tests/analyser_dependency.ml
+++ b/tests/analyser_dependency.ml
@@ -1,4 +1,3 @@
-open OUnit2
open StdLabels
module A = ImportAnalyser.Dependency
module Cont = ImportContainers
@@ -6,6 +5,7 @@ module Syntax = ImportConf.Syntax
module Expression = ImportExpression.T
module Table = ImportDataTypes.Table
open ConfLoader
+open Test_migration
let test_order =
"Order" >:: fun _ ->
@@ -13,8 +13,9 @@ let test_order =
let expected_order =
[ external_table_last; external_table_other; external_table_source ]
in
- assert_equal ~cmp:(cmp_list cmp_source) ~printer:show_sources expected_order
- order
+ Alcotest.check
+ (Alcotest.list Test_migration.table_testable)
+ "" expected_order order
let test_columns =
"Columns" >:: fun _ ->
@@ -25,9 +26,8 @@ let test_columns =
|> A.columns
in
- assert_equal
- ~cmp:(fun a b -> 0 = Cont.IntSet.compare a b)
- ~printer:Cont.show_intSet expected_colums columns
+ Alcotest.check Test_migration.int_container_testable "" expected_colums
+ columns
let test_keys =
"Keys" >:: fun _ ->
@@ -49,8 +49,7 @@ let test_keys =
|> List.find ~f:(fun v -> A.table v = external_table_other)
|> A.keys
in
-
- assert_equal ~cmp:(cmp_list key_cmp) ~printer:keys_printer expected_keys keys
+ Alcotest.(check (list Test_migration.dep_key_testable)) "" expected_keys keys
let test_keys_missing =
"Keys missing" >:: fun _ ->
@@ -72,13 +71,13 @@ let test_keys_missing =
|> A.keys
in
- assert_equal ~cmp:(cmp_list key_cmp) ~printer:keys_printer expected_keys keys
+ Alcotest.(check (list Test_migration.dep_key_testable)) "" expected_keys keys
let test_unknow_source =
"Unknown source" >:: fun _ ->
let conf = { conf with externals = [] } in
- assert_raises (ImportErrors.Unknown_source "last_file") (fun () ->
- A.get_process_order conf)
+ Alcotest.check_raises "" (ImportErrors.Unknown_source "last_file") (fun () ->
+ ignore @@ A.get_process_order conf)
let test_unordered =
"Unorderd references" >:: fun _ ->
@@ -86,8 +85,7 @@ let test_unordered =
error. *)
let conf =
load
- {|version = 1
-[source]
+ {|[source]
file = "source.xlsx"
name = "source"
@@ -106,16 +104,15 @@ let test_unordered =
[sheet]
columns = []|}
in
- assert_raises (ImportErrors.Unknown_source "other") (fun () ->
- A.get_process_order conf)
+ Alcotest.check_raises "" (ImportErrors.Unknown_source "other") (fun () ->
+ ignore @@ A.get_process_order conf)
let test_circular =
"Unlinked reference" >:: fun _ ->
(* A reference to itself should be understood *)
let conf =
load
- {|version = 1
-[source]
+ {|[source]
file = "source.xlsx"
name = "source"
@@ -130,7 +127,7 @@ let test_circular =
in
let elements = A.get_process_order conf in
- assert_equal ~printer:string_of_int 1 (List.length elements)
+ Alcotest.check Alcotest.int "" 1 (List.length elements)
let test_unlinked =
"Circular reference" >:: fun _ ->
@@ -164,8 +161,8 @@ let test_unlinked =
uniq = [];
}
in
- assert_raises (ImportErrors.Unknown_source "circular2") (fun () ->
- A.get_process_order conf |> List.map ~f:A.table)
+ Alcotest.check_raises "" (ImportErrors.Unknown_source "circular2") (fun () ->
+ A.get_process_order conf |> List.map ~f:A.table |> ignore)
let conf_with_unlinked =
Syntax.
@@ -204,7 +201,9 @@ let test_order_filter =
|> A.get_process_order |> List.map ~f:A.table
in
let expected_order = [ external_table_other; external_table_source ] in
- assert_equal ~printer:show_sources expected_order order
+ Alcotest.check
+ (Alcotest.list Test_migration.table_testable)
+ "" expected_order order
(** A table referenced only in the order list shall be loaded correctly *)
let test_order_sort =
@@ -217,7 +216,9 @@ let test_order_sort =
|> A.get_process_order |> List.map ~f:A.table
in
let expected_order = [ external_table_other; external_table_source ] in
- assert_equal ~printer:show_sources expected_order order
+ Alcotest.check
+ (Alcotest.list Test_migration.table_testable)
+ "" expected_order order
(** A table referenced only in the uniq list shall be loaded correctly *)
let test_order_uniq =
@@ -230,7 +231,9 @@ let test_order_uniq =
|> A.get_process_order |> List.map ~f:A.table
in
let expected_order = [ external_table_other; external_table_source ] in
- assert_equal ~printer:show_sources expected_order order
+ Alcotest.check
+ (Alcotest.list Test_migration.table_testable)
+ "" expected_order order
let tests =
"analyser_dependency"