| 1381 | |
| 1382 | template <typename ScalarType> |
| 1383 | void CheckListCastError(const ScalarType& scalar, |
| 1384 | const std::shared_ptr<DataType>& to_type) { |
| 1385 | StatusCode code; |
| 1386 | std::string expected_message; |
| 1387 | if (scalar.type->id() == Type::FIXED_SIZE_LIST) { |
| 1388 | code = StatusCode::TypeError; |
| 1389 | expected_message = |
| 1390 | "Size of FixedSizeList is not the same. input list: " + scalar.type->ToString() + |
| 1391 | " output list: " + to_type->ToString(); |
| 1392 | } else { |
| 1393 | code = StatusCode::Invalid; |
| 1394 | expected_message = |
| 1395 | "ListType can only be casted to FixedSizeListType if the lists are all the " |
| 1396 | "expected size."; |
| 1397 | } |
| 1398 | |
| 1399 | EXPECT_RAISES_WITH_CODE_AND_MESSAGE_THAT(code, ::testing::HasSubstr(expected_message), |
| 1400 | Cast(scalar, to_type)); |
| 1401 | } |
| 1402 | |
| 1403 | template <typename T> |
| 1404 | class TestListLikeScalar : public ::testing::Test { |