aboutsummaryrefslogtreecommitdiff
path: root/tests/test_migration.ml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_migration.ml')
-rw-r--r--tests/test_migration.ml55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/test_migration.ml b/tests/test_migration.ml
new file mode 100644
index 0000000..35480d1
--- /dev/null
+++ b/tests/test_migration.ml
@@ -0,0 +1,55 @@
+(** Migration from OUnit to Alcotest *)
+let ( >:: ) : string -> (unit -> unit) -> unit Alcotest.test_case =
+ fun name test -> Alcotest.test_case name `Quick test
+
+let ( >::: ) : string -> unit Alcotest.test_case list -> unit Alcotest.test =
+ fun test_name tests -> (test_name, tests)
+
+let make_test :
+ (module Alcotest.TESTABLE with type t = 't) -> 't Alcotest.testable =
+ fun (type t) (module T : Alcotest.TESTABLE with type t = t) ->
+ Alcotest.testable T.pp T.equal
+
+(** Create a testable for SQLite data type *)
+let sql_testable =
+ make_test
+ (module struct
+ type t = Sqlite3.Data.t =
+ | NONE
+ | NULL
+ | INT of int64
+ | FLOAT of float
+ | TEXT of string
+ | BLOB of string
+ [@@deriving show, eq]
+ end)
+
+let csv_data_type_testable =
+ make_test
+ (module struct
+ type t = ImportCSV.DataType.t =
+ | Null
+ | Error of string
+ | Content of string
+ | Integer of int
+ | Float of float
+ [@@deriving show, eq]
+ end)
+
+let csv_result = Alcotest.(list @@ array @@ csv_data_type_testable)
+let data_type_testable = make_test (module ImportDataTypes.Types)
+let extern_testable = make_test (module ImportConf.Syntax.Extern)
+let table_testable = make_test (module ImportDataTypes.Table)
+let int_container_testable = make_test (module ImportContainers.IntSet)
+
+let expression_testable =
+ make_test
+ (module struct
+ type t = ImportConf.Path.t ImportExpression.T.t [@@deriving show, eq]
+ end)
+
+let dep_key_testable =
+ make_test
+ (module struct
+ type t = ImportAnalyser.Dependency.key [@@deriving show, eq]
+ end)