| 1335 | |
| 1336 | template <typename ScalarType> |
| 1337 | void CheckListCastError(const ScalarType& scalar, |
| 1338 | const std::shared_ptr<DataType>& to_type) { |
| 1339 | StatusCode code; |
| 1340 | std::string expected_message; |
| 1341 | if (scalar.type->id() == Type::FIXED_SIZE_LIST) { |
| 1342 | code = StatusCode::TypeError; |
| 1343 | expected_message = |
| 1344 | "Size of FixedSizeList is not the same. input list: " + scalar.type->ToString() + |
| 1345 | " output list: " + to_type->ToString(); |
| 1346 | } else { |
| 1347 | code = StatusCode::Invalid; |
| 1348 | expected_message = |
| 1349 | "ListType can only be casted to FixedSizeListType if the lists are all the " |
| 1350 | "expected size."; |
| 1351 | } |
| 1352 | |
| 1353 | EXPECT_RAISES_WITH_CODE_AND_MESSAGE_THAT(code, ::testing::HasSubstr(expected_message), |
| 1354 | Cast(scalar, to_type)); |
| 1355 | } |
| 1356 | |
| 1357 | template <typename T> |
| 1358 | class TestListLikeScalar : public ::testing::Test { |