blob: 76c25b26adf51a3d1fe3a7abfd8401a51e4eb0bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
open OUnit2
let printer = function
| Sqlite3.Data.INT t -> Int64.to_string t
| Sqlite3.Data.NONE -> "None"
| Sqlite3.Data.NULL -> "Null"
| Sqlite3.Data.FLOAT f -> Float.to_string f
| Sqlite3.Data.TEXT t | Sqlite3.Data.BLOB t -> t
let test_suit =
[
( "Int_of_int" >:: fun _ ->
assert_equal ~printer (Sqlite3.Data.INT 37354L)
(ImportSQL.Math.int (Sqlite3.Data.INT 37354L)) );
( "Int_of_string" >:: fun _ ->
assert_equal ~printer (Sqlite3.Data.INT 37354L)
(ImportSQL.Math.int (Sqlite3.Data.TEXT "37354")) );
( "Int_of_string2" >:: fun _ ->
assert_equal ~printer (Sqlite3.Data.INT 37354L)
(ImportSQL.Math.int (Sqlite3.Data.TEXT "37354.0")) );
( "Int_of_float" >:: fun _ ->
assert_equal ~printer (Sqlite3.Data.INT 37354L)
(ImportSQL.Math.int (Sqlite3.Data.FLOAT 37354.0)) );
( "Int_of_Text" >:: fun _ ->
assert_equal ~printer Sqlite3.Data.NULL
(ImportSQL.Math.int (Sqlite3.Data.TEXT "-")) );
]
let tests = "sql_int" >::: test_suit
|