Add tests with explicit cast

This commit is contained in:
Dmitry Kardymon 2023-05-31 11:50:25 +00:00
parent daaae3f573
commit 444ce60aeb
2 changed files with 77 additions and 18 deletions

View File

@ -20,17 +20,40 @@
2
-1
-2
1970-01-01
2023-05-30
2023-05-30
2023-05-30
1970-01-01
2023-05-30
2023-05-30
1970-01-01
2023-05-30 14:38:20
2023-05-30 14:38:20
2023-05-30 14:38:20
2023-05-30 14:38:20
61f0c404-5cb3-11e7-907b-a6006ad3dba0
59f0c404-5cb3-11e7-907b-a6006ad3dba0
1970-01-01
2023-05-30
2023-05-30
2023-05-30
1970-01-01
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
1970-01-20
2023-05-30
1970-01-01
2023-05-30 14:38:20
2023-05-30 14:38:20
2023-05-30 14:38:20
2023-05-30 14:38:20
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19
1970-01-01 00:00:19

View File

@ -26,19 +26,55 @@ select toUInt256OrDefault('1xx', cast(2 as UInt256));
select toInt256OrDefault('-1', cast(-2 as Int256));
select toInt256OrDefault('-1xx', cast(-2 as Int256));
select toDateOrDefault('2020-0x-02');
SELECT toUUIDOrDefault('61f0c404-5cb3-11e7-907b-a6006ad3dba0', cast('59f0c404-5cb3-11e7-907b-a6006ad3dba0' as UUID));
SELECT toUUIDOrDefault('-----61f0c404-5cb3-11e7-907b-a6006ad3dba0', cast('59f0c404-5cb3-11e7-907b-a6006ad3dba0' as UUID));
select toDateOrDefault('1xxx');
select toDateOrDefault('2023-05-30');
select toDateOrDefault('2023-05-30', '2000-01-01'::Date);
select toDateOrDefault('2020-0x-02', '2023-05-30'::Date);
select toDateOrDefault('1xx', '2023-05-30'::Date);
select toDateOrDefault(-1);
select toDateOrDefault(19507);
select toDateOrDefault(cast(19 as Int8));
select toDateOrDefault(cast(19 as UInt8));
select toDateOrDefault(cast(19 as Int16));
select toDateOrDefault(cast(19 as UInt16));
select toDateOrDefault(cast(19 as Int32));
select toDateOrDefault(cast(19 as UInt32));
select toDateOrDefault(cast(19 as Int64));
select toDateOrDefault(cast(19 as UInt64));
select toDateOrDefault(cast(19 as Int128));
select toDateOrDefault(cast(19 as UInt128));
select toDateOrDefault(cast(19 as Int256));
select toDateOrDefault(cast(19 as UInt256));
select toDateOrDefault(19507, '2000-01-01'::Date);
select toDateOrDefault(-1, '2000-01-01'::Date);
select toDateTimeOrDefault('2023-05-30 14:38:20');
select toDateTimeOrDefault('2023-05-30 14:38:20', 'UTC');
select toString(toDateTimeOrDefault('s2023', 'Asia/Istanbul', '2023-05-30 14:38:20'::DateTime('Asia/Istanbul')), 'Asia/Istanbul');
select toString(toDateTimeOrDefault('1xxx', 'Asia/Istanbul', '2023-05-30 14:38:20'::DateTime('Asia/Istanbul')), 'Asia/Istanbul');
select toDateTimeOrDefault(1685457500);
SELECT toUUIDOrDefault('61f0c404-5cb3-11e7-907b-a6006ad3dba0', cast('59f0c404-5cb3-11e7-907b-a6006ad3dba0' as UUID));
SELECT toUUIDOrDefault('-----61f0c404-5cb3-11e7-907b-a6006ad3dba0', cast('59f0c404-5cb3-11e7-907b-a6006ad3dba0' as UUID));
select toDateTimeOrDefault(cast(19 as Int8));
select toDateTimeOrDefault(cast(19 as UInt8));
select toDateTimeOrDefault(cast(19 as Int16));
select toDateTimeOrDefault(cast(19 as UInt16));
select toDateTimeOrDefault(cast(19 as Int32));
select toDateTimeOrDefault(cast(19 as UInt32));
select toDateTimeOrDefault(cast(19 as Int64));
select toDateTimeOrDefault(cast(19 as UInt64));
select toDateTimeOrDefault(cast(19 as Int128));
select toDateTimeOrDefault(cast(19 as UInt128));
select toDateTimeOrDefault(cast(19 as Int256));
select toDateTimeOrDefault(cast(19 as UInt256));