whatever
This commit is contained in:
parent
b2e3a70424
commit
b70c66c8c8
@ -1,23 +1,20 @@
|
|||||||
open Csv
|
|
||||||
open Alcotest
|
|
||||||
|
|
||||||
(* Function to read CSV file *)
|
(* Function to read CSV file *)
|
||||||
let read_csv filename =
|
let read_csv filename =
|
||||||
let ic = open_in filename in
|
let ic = open_in filename in
|
||||||
let csv = Csv.load_in ic in
|
let csv = (Csv.load_in : in_channel -> 'a) ic in
|
||||||
csv
|
csv
|
||||||
|
|
||||||
(* Test to check if the CSV file is read correctly *)
|
(* Test to check if the CSV file is read correctly *)
|
||||||
let test_read_csv () =
|
let test_read_csv () =
|
||||||
let csv_data = read_csv "files/csv/data.csv" in
|
let csv_data = read_csv "files/csv/data.csv" in
|
||||||
let nb_columns = Csv.columns csv_data in
|
let nb_columns = Csv.columns csv_data in
|
||||||
check int "Number of columns" nb_columns 5
|
Alcotest.check Alcotest.int "Number of columns" nb_columns 5
|
||||||
|
|
||||||
|
|
||||||
(* Run the test *)
|
(* Run the test *)
|
||||||
let () =
|
let () =
|
||||||
run "CSV Tests" [
|
Alcotest.run "CSV Tests" [
|
||||||
"Read CSV", [
|
"Read CSV", [
|
||||||
test_case "Read and validate CSV" `Quick test_read_csv
|
Alcotest.test_case "Read and validate CSV" `Quick test_read_csv
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user