| 220 | {TestCase1(), TestCase2(), TestCase3()}))); |
| 221 | |
| 222 | TEST_F(MapDefunOpTest, InvalidArguments) { |
| 223 | int thread_num = 2, cpu_num = 2; |
| 224 | TF_ASSERT_OK(InitThreadPool(thread_num)); |
| 225 | std::vector<TestCase> test_cases = {InvalidOutputTypes(), |
| 226 | InvalidOutputShapes(), InvalidInputs()}; |
| 227 | for (auto& test_case : test_cases) { |
| 228 | TF_ASSERT_OK(InitFunctionLibraryRuntime(test_case.func_lib, cpu_num)); |
| 229 | |
| 230 | std::unique_ptr<OpKernel> map_defun_kernel; |
| 231 | TF_ASSERT_OK(CreateMapDefunOpKernel( |
| 232 | test_case.t_arguments, test_case.t_captured, test_case.output_dtypes, |
| 233 | test_case.output_shapes, test_case.func, |
| 234 | test_case.max_intra_op_parallelism, &map_defun_kernel)); |
| 235 | gtl::InlinedVector<TensorValue, 4> inputs; |
| 236 | for (auto& arg : test_case.arguments) { |
| 237 | inputs.emplace_back(&arg); |
| 238 | } |
| 239 | for (auto& captured_input : test_case.captured_inputs) { |
| 240 | inputs.emplace_back(&captured_input); |
| 241 | } |
| 242 | std::unique_ptr<OpKernelContext> context; |
| 243 | TF_ASSERT_OK( |
| 244 | CreateMapDefunContext(map_defun_kernel.get(), &inputs, &context)); |
| 245 | EXPECT_EQ(RunOpKernel(map_defun_kernel.get(), context.get()).code(), |
| 246 | tensorflow::error::INVALID_ARGUMENT); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | } // namespace |
| 251 | } // namespace data |
nothing calls this directly
no test coverage detected