aboutsummaryrefslogtreecommitdiff
path: root/tests/sql_date.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2024-03-14 08:26:58 +0100
committerSébastien Dailly <sebastien@dailly.me>2024-03-14 08:26:58 +0100
commit6b377719c10d5ab3343fd5221f99a4a21008e25a (patch)
treea7c1e9a820d339a2f161af3e09cf9e3161286796 /tests/sql_date.ml
Initial commitmain
Diffstat (limited to 'tests/sql_date.ml')
-rw-r--r--tests/sql_date.ml18
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