diff options
Diffstat (limited to 'tests/sql_date.ml')
-rw-r--r-- | tests/sql_date.ml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/sql_date.ml b/tests/sql_date.ml new file mode 100644 index 0000000..4becdf5 --- /dev/null +++ b/tests/sql_date.ml @@ -0,0 +1,18 @@ +open OUnit2 + +let test_suit = + [ + ( "Parse date" >:: fun _ -> + let text_date = Sqlite3.Data.TEXT "2002-04-08 15:59:41.000" + and format_date = Sqlite3.Data.TEXT "%Y-%m-%d %H:%M:%S.000" in + + assert_equal (Sqlite3.Data.INT 37354L) + (ImportSQL.Date.f format_date text_date) ); + ( "Parse date as int" >:: fun _ -> + let int_date = Sqlite3.Data.INT 37354L + and format_date = Sqlite3.Data.TEXT "%Y-%m-%d %H:%M:%S.000" in + + assert_equal int_date (ImportSQL.Date.f format_date int_date) ); + ] + +let tests = "sql_date" >::: test_suit |