aboutsummaryrefslogtreecommitdiff
path: root/tests/importCSV_test.ml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/importCSV_test.ml')
-rw-r--r--tests/importCSV_test.ml29
1 files changed, 29 insertions, 0 deletions
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