diff options
Diffstat (limited to 'tests/sql_db.ml')
-rw-r--r-- | tests/sql_db.ml | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/tests/sql_db.ml b/tests/sql_db.ml index ab402bc..34f5b12 100644 --- a/tests/sql_db.ml +++ b/tests/sql_db.ml @@ -67,10 +67,10 @@ columns = [ ":B", ":E"]|} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 123); (1, Integer 2); (4, Integer 5) ] ] ~expected: - (Ok ImportCSV.DataType.[ [| Content "123_"; Integer 2; Integer 5 |] ]) + (Ok ImportDataTypes.Value.[ [| Content "123_"; Integer 2; Integer 5 |] ]) (** Ensure the behavior of the sum function when a filter is given. It is expected to accumulate the values over each line *) @@ -87,7 +87,7 @@ columns = [ "sum(:C, [:B], [:A])", ]|} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (1, Content "A"); (2, Integer 100) ]; [ (0, Integer 2); (1, Content "A"); (2, Integer 100) ]; @@ -95,7 +95,7 @@ columns = [ ] ~expected: (Ok - ImportCSV.DataType. + ImportDataTypes.Value. [ [| Integer 1; Integer 100 |]; [| Integer 2; Integer 200 |]; @@ -115,13 +115,18 @@ columns = [ "sum(:C, [], [])", ]|} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (2, Integer 100) ]; [ (0, Integer 2); (2, Integer 100) ]; ] ~expected: - (Ok [ [| ImportCSV.DataType.Integer 1; ImportCSV.DataType.Integer 200 |] ]) + (Ok + [ + [| + ImportDataTypes.Value.Integer 1; ImportDataTypes.Value.Integer 200; + |]; + ]) (** Ensure the behavior of the sum function when no filter is given. It is expected to get the total sum for each line *) @@ -138,7 +143,7 @@ columns = [ "sum(:C, [], [:A])", ]|} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (2, Integer 100) ]; [ (0, Integer 2); (2, Integer 100) ]; @@ -146,8 +151,12 @@ columns = [ ~expected: (Ok [ - [| ImportCSV.DataType.Integer 1; ImportCSV.DataType.Integer 100 |]; - [| ImportCSV.DataType.Integer 2; ImportCSV.DataType.Integer 200 |]; + [| + ImportDataTypes.Value.Integer 1; ImportDataTypes.Value.Integer 100; + |]; + [| + ImportDataTypes.Value.Integer 2; ImportDataTypes.Value.Integer 200; + |]; ]) let sum_group = @@ -163,7 +172,7 @@ columns = [ "sum(:C, [:A], [])", ]|} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (2, Integer 100) ]; [ (0, Integer 1); (2, Integer 100) ]; @@ -171,7 +180,7 @@ columns = [ ] ~expected: (Ok - ImportCSV.DataType. + ImportDataTypes.Value. [ [| Integer 1; Integer 200 |]; [| Integer 1; Integer 200 |]; @@ -193,7 +202,7 @@ columns = [ "sum(:C, [:A], [])", ]|} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (2, Integer 100) ]; [ (0, Integer 1); (2, Integer 100) ]; @@ -201,7 +210,7 @@ columns = [ ] ~expected: (Ok - ImportCSV.DataType. + ImportDataTypes.Value. [ [| Integer 1; Integer 200 |]; [| Integer 2; Integer 100 |] ]) let filter_group = @@ -222,13 +231,13 @@ filters = [ |} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (1, Integer 100) ]; [ (0, Integer 2); (1, Integer 150) ]; [ (0, Integer 3); (1, Integer 200) ]; ] - ~expected:(Ok ImportCSV.DataType.[ [| Integer 3 |] ]) + ~expected:(Ok ImportDataTypes.Value.[ [| Integer 3 |] ]) (** The first filter will prevent the max value to pop, and only the second one will be reported *) @@ -251,13 +260,13 @@ filters = [ |} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (1, Integer 100) ]; [ (0, Integer 2); (1, Integer 150) ]; [ (0, Integer 3); (1, Integer 200) ]; ] - ~expected:(Ok ImportCSV.DataType.[ [| Integer 2 |] ]) + ~expected:(Ok ImportDataTypes.Value.[ [| Integer 2 |] ]) (** In this case, we first filter the line and keep only the max value, but the second filter will match the result and will produce an empty list *) @@ -280,7 +289,7 @@ filters = [ |} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (1, Integer 100) ]; [ (0, Integer 2); (1, Integer 150) ]; @@ -311,13 +320,13 @@ filters = [ |} ~input: - ImportCSV.DataType. + ImportDataTypes.Value. [ [ (0, Integer 1); (1, Integer 100) ]; [ (0, Integer 2); (1, Integer 150) ]; [ (0, Integer 3); (1, Integer 200) ]; ] - ~expected:(Ok [ [| ImportCSV.DataType.Integer 1 |] ]) + ~expected:(Ok [ [| ImportDataTypes.Value.Integer 1 |] ]) let test_suit = [ |