|
27 | 27 |
|
28 | 28 | #include "iceberg/type.h" |
29 | 29 | #include "matchers.h" |
| 30 | +#include "temporal_test_helper.h" |
30 | 31 |
|
31 | 32 | namespace iceberg { |
32 | 33 |
|
@@ -689,6 +690,31 @@ INSTANTIATE_TEST_SUITE_P( |
689 | 690 | .source_literal = Literal::Long(42L), |
690 | 691 | .target_type = timestamp_tz(), |
691 | 692 | .expected_literal = Literal::TimestampTz(42L)}, |
| 693 | + CastLiteralTestParam{ |
| 694 | + .test_name = "TimestampToDate", |
| 695 | + .source_literal = |
| 696 | + Literal::Timestamp(TemporalTestHelper::CreateTimestamp({.year = 2021, |
| 697 | + .month = 6, |
| 698 | + .day = 1, |
| 699 | + .hour = 11, |
| 700 | + .minute = 43, |
| 701 | + .second = 20})), |
| 702 | + .target_type = date(), |
| 703 | + .expected_literal = Literal::Date( |
| 704 | + TemporalTestHelper::CreateDate({.year = 2021, .month = 6, .day = 1}))}, |
| 705 | + CastLiteralTestParam{ |
| 706 | + .test_name = "TimestampTzToDate", |
| 707 | + .source_literal = Literal::TimestampTz( |
| 708 | + TemporalTestHelper::CreateTimestampTz({.year = 2021, |
| 709 | + .month = 1, |
| 710 | + .day = 1, |
| 711 | + .hour = 7, |
| 712 | + .minute = 43, |
| 713 | + .second = 20, |
| 714 | + .tz_offset_minutes = 480})), |
| 715 | + .target_type = date(), |
| 716 | + .expected_literal = Literal::Date( |
| 717 | + TemporalTestHelper::CreateDate({.year = 2020, .month = 12, .day = 31}))}, |
692 | 718 | // Float cast tests |
693 | 719 | CastLiteralTestParam{.test_name = "FloatToDouble", |
694 | 720 | .source_literal = Literal::Float(2.0f), |
|
0 commit comments