From 6b377719c10d5ab3343fd5221f99a4a21008e25a Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 14 Mar 2024 08:26:58 +0100 Subject: Initial commit --- tests/importCSV_test.ml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/importCSV_test.ml (limited to 'tests/importCSV_test.ml') diff --git a/tests/importCSV_test.ml b/tests/importCSV_test.ml new file mode 100644 index 0000000..bc21992 --- /dev/null +++ b/tests/importCSV_test.ml @@ -0,0 +1,29 @@ +open OUnit2 +open ImportCSV + +let test_suit = + [ + ( "Column A" >:: fun _ -> + assert_equal + ~printer:(fun i -> Printf.sprintf "%d (%s)" i (Csv.column_to_string i)) + 1 (Csv.column_of_string "A") ); + ( "Column a" >:: fun _ -> + assert_equal + ~printer:(fun i -> Printf.sprintf "%d (%s)" i (Csv.column_to_string i)) + 1 (Csv.column_of_string "a") ); + ( "Column name" >:: fun _ -> + let () = + for i = 1 to 1_000 do + let column_name = Csv.column_to_string i in + let column_index = Csv.column_of_string column_name in + + assert_equal + ~printer:(fun i -> + Printf.sprintf "%d (%s)" i (Csv.column_to_string i)) + i column_index + done + in + () ); + ] + +let tests = "importCSV_test" >::: test_suit -- cgit v1.2.3