HuaHuaY commented on code in PR #206:
URL: https://github.com/apache/iceberg-cpp/pull/206#discussion_r2371393990


##########
test/literal_test.cc:
##########
@@ -120,23 +137,35 @@ TEST(LiteralTest, LongCastTo) {
   auto long_literal = Literal::Long(42L);
 
   // Cast to Int (within range)
-  auto int_result = long_literal.CastTo(iceberg::int32());
-  ASSERT_THAT(int_result, IsOk());
-  EXPECT_EQ(int_result->type()->type_id(), TypeId::kInt);
-  EXPECT_EQ(int_result->ToString(), "42");
+  AssertCastSucceeds(long_literal.CastTo(iceberg::int32()), TypeId::kInt, 42);
 
   // Cast to Float
-  auto float_result = long_literal.CastTo(iceberg::float32());
-  ASSERT_THAT(float_result, IsOk());
-  EXPECT_EQ(float_result->type()->type_id(), TypeId::kFloat);
+  AssertCastSucceeds(long_literal.CastTo(iceberg::float32()), TypeId::kFloat, 
42.0f);
 
   // Cast to Double
-  auto double_result = long_literal.CastTo(iceberg::float64());
-  ASSERT_THAT(double_result, IsOk());
-  EXPECT_EQ(double_result->type()->type_id(), TypeId::kDouble);
+  AssertCastSucceeds(long_literal.CastTo(iceberg::float64()), TypeId::kDouble, 
42.0);
+
+  // Cast to Date
+  AssertCastSucceeds(long_literal.CastTo(iceberg::date()), TypeId::kDate, 42);
+
+  // Cast to Time
+  AssertCastSucceeds(long_literal.CastTo(iceberg::time()), TypeId::kTime,
+                     static_cast<int64_t>(42L));

Review Comment:
   `static_cast<int64_t>(42)` or `42LL`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to