@@ -38,8 +38,8 @@ template <typename T>
3838void AssertCastSucceeds (const Result<Literal>& result, TypeId expected_type_id,
3939 const T& expected_value) {
4040 ASSERT_THAT (result, IsOk ());
41- EXPECT_EQ (result->type ()->type_id (), expected_type_id);
42- ASSERT_NO_THROW ( EXPECT_EQ (std::get<T>(result->value ()), expected_value) )
41+ ASSERT_EQ (result->type ()->type_id (), expected_type_id);
42+ EXPECT_EQ (std::get<T>(result->value ()), expected_value)
4343 << " Type mismatch in std::get. Expected type for TypeId "
4444 << static_cast <int >(expected_type_id);
4545}
@@ -145,16 +145,14 @@ TEST(LiteralTest, LongCastTo) {
145145 AssertCastSucceeds (long_literal.CastTo (date ()), TypeId::kDate , 42 );
146146
147147 // Cast to Time
148- AssertCastSucceeds (long_literal.CastTo (time ()), TypeId::kTime ,
149- static_cast <int64_t >(42L ));
148+ AssertCastSucceeds (long_literal.CastTo (time ()), TypeId::kTime , int64_t {42 });
150149
151150 // Cast to Timestamp
152- AssertCastSucceeds (long_literal.CastTo (timestamp ()), TypeId::kTimestamp ,
153- static_cast <int64_t >(42L ));
151+ AssertCastSucceeds (long_literal.CastTo (timestamp ()), TypeId::kTimestamp , int64_t {42 });
154152
155153 // Cast to TimestampTz
156154 AssertCastSucceeds (long_literal.CastTo (timestamp_tz ()), TypeId::kTimestampTz ,
157- static_cast < int64_t >( 42L ) );
155+ int64_t { 42 } );
158156}
159157
160158TEST (LiteralTest, LongCastToOverflow) {
@@ -207,8 +205,7 @@ TEST(LiteralTest, FloatCastTo) {
207205 auto float_literal = Literal::Float (2 .0f );
208206
209207 // Cast to Double
210- AssertCastSucceeds (float_literal.CastTo (float64 ()), TypeId::kDouble ,
211- static_cast <double >(2 .0f ));
208+ AssertCastSucceeds (float_literal.CastTo (float64 ()), TypeId::kDouble , double {2 .0f });
212209}
213210
214211// Double type tests
@@ -242,10 +239,8 @@ TEST(LiteralTest, DoubleCastTo) {
242239
243240TEST (LiteralTest, DoubleCastToOverflow) {
244241 // Test overflow cases for Double to Float
245- auto max_double =
246- Literal::Double (static_cast <double >(std::numeric_limits<float >::max ()) * 2 );
247- auto min_double =
248- Literal::Double (-static_cast <double >(std::numeric_limits<float >::max ()) * 2 );
242+ auto max_double = Literal::Double (double {std::numeric_limits<float >::max ()} * 2 );
243+ auto min_double = Literal::Double (-double {std::numeric_limits<float >::max ()} * 2 );
249244
250245 auto max_result = max_double.CastTo (float32 ());
251246 ASSERT_THAT (max_result, IsOk ());
@@ -313,8 +308,7 @@ TEST(LiteralTest, BinaryCastTo) {
313308 AssertCastSucceeds (binary_literal.CastTo (fixed (4 )), TypeId::kFixed , data4);
314309
315310 // Cast to Fixed with different length should fail
316- EXPECT_THAT (binary_literal.CastTo (fixed (5 )),
317- IsError (ErrorKind::kInvalidArgument ));
311+ EXPECT_THAT (binary_literal.CastTo (fixed (5 )), IsError (ErrorKind::kInvalidArgument ));
318312}
319313
320314// Fixed type tests
0 commit comments