added compatibility tests for date

This commit is contained in:
gandeevanr
2024-07-23 07:12:49 -07:00
parent 871fae3286
commit 7bb3412e66
2 changed files with 46 additions and 7 deletions

View File

@@ -37,12 +37,9 @@ pub enum SingleRowFunc {
Trim,
Round,
Length,
<<<<<<< HEAD
Min,
Max,
=======
Date,
>>>>>>> d25b16e (Implement the Date() method)
}
impl ToString for SingleRowFunc {
@@ -57,12 +54,9 @@ impl ToString for SingleRowFunc {
SingleRowFunc::Trim => "trim".to_string(),
SingleRowFunc::Round => "round".to_string(),
SingleRowFunc::Length => "length".to_string(),
<<<<<<< HEAD
SingleRowFunc::Min => "min".to_string(),
SingleRowFunc::Max => "max".to_string(),
=======
SingleRowFunc::Date => "date".to_string(),
>>>>>>> d25b16e (Implement the Date() method)
}
}
}

View File

@@ -142,6 +142,7 @@ do_execsql_test length-null {
do_execsql_test length-empty-text {
SELECT length('');
} {0}
do_execsql_test min-number {
select min(-10,2,3)
} {-10}
@@ -164,4 +165,48 @@ do_execsql_test max-str {
do_execsql_test max-null {
select max(null,null)
} {}
} {}
do_execsql_test date-current-date {
SELECT length(date('now')) = 10;
} {1}
do_execsql_test date-specific-date {
SELECT date('2023-05-18');
} {2023-05-18}
do_execsql_test date-with-time {
SELECT date('2023-05-18 15:30:45');
} {2023-05-18}
do_execsql_test date-iso8601 {
SELECT date('2023-05-18T15:30:45');
} {2023-05-18}
do_execsql_test date-with-milliseconds {
SELECT date('2023-05-18 15:30:45.123');
} {2023-05-18}
do_execsql_test date-julian-day-integer {
SELECT date(2460082);
} {2023-05-17}
do_execsql_test date-julian-day-float {
SELECT date(2460082.5);
} {2023-05-18}
do_execsql_test date-invalid-input {
SELECT date('not a date');
} {{}}
do_execsql_test date-null-input {
SELECT date(NULL);
} {{}}
do_execsql_test date-out-of-range {
SELECT date('10001-01-01');
} {{}}
do_execsql_test date-time-only {
SELECT date('15:30:45');
} {2000-01-01}