| 1183 | }; |
| 1184 | |
| 1185 | void TestCallScalarFunctionArgumentValidation::DoTest(FunctionCallerMaker caller_maker) { |
| 1186 | ASSERT_OK_AND_ASSIGN(auto test_copy, caller_maker("test_copy", {int32()})); |
| 1187 | |
| 1188 | // Copy accepts only a single array argument |
| 1189 | Datum d1(GetInt32Array(10)); |
| 1190 | |
| 1191 | // Too many args |
| 1192 | std::vector<Datum> args = {d1, d1}; |
| 1193 | ASSERT_RAISES(Invalid, test_copy->Call(args)); |
| 1194 | |
| 1195 | // Too few |
| 1196 | args = {}; |
| 1197 | ASSERT_RAISES(Invalid, test_copy->Call(args)); |
| 1198 | |
| 1199 | // Cannot do scalar |
| 1200 | Datum d1_scalar(std::make_shared<Int32Scalar>(5)); |
| 1201 | ASSERT_OK_AND_ASSIGN(auto result, test_copy->Call({d1})); |
| 1202 | ASSERT_OK_AND_ASSIGN(result, test_copy->Call({d1_scalar})); |
| 1203 | } |
| 1204 | |
| 1205 | TEST_F(TestCallScalarFunctionArgumentValidation, SimpleCall) { |
| 1206 | TestCallScalarFunctionArgumentValidation::DoTest(SimpleFunctionCaller::Maker); |
nothing calls this directly
no test coverage detected