| 298 | } |
| 299 | |
| 300 | TEST(OpPadAndStack_Negative, input_format_not_same) |
| 301 | { |
| 302 | cudaStream_t stream; |
| 303 | ASSERT_EQ(cudaSuccess, cudaStreamCreate(&stream)); |
| 304 | |
| 305 | int srcWidth = 12; |
| 306 | int srcHeight = 13; |
| 307 | int numBatches = 3; |
| 308 | int dstWidth = 111; |
| 309 | int dstHeight = 131; |
| 310 | float borderValue = 0.f; |
| 311 | |
| 312 | nvcv::Tensor inTop(1, {numBatches, 1}, nvcv::FMT_S32); |
| 313 | nvcv::Tensor inLeft(1, {numBatches, 1}, nvcv::FMT_S32); |
| 314 | |
| 315 | std::vector<nvcv::Image> srcImgVec; |
| 316 | for (int b = 0; b < numBatches - 1; ++b) |
| 317 | { |
| 318 | srcImgVec.emplace_back(nvcv::Size2D{srcWidth, srcHeight}, nvcv::FMT_RGBA8); |
| 319 | } |
| 320 | srcImgVec.emplace_back(nvcv::Size2D{srcWidth, srcHeight}, nvcv::FMT_RGB8); |
| 321 | nvcv::ImageBatchVarShape imgBatchSrc(numBatches); |
| 322 | imgBatchSrc.pushBack(srcImgVec.begin(), srcImgVec.end()); |
| 323 | |
| 324 | nvcv::Tensor imgDst(numBatches, {dstWidth, dstHeight}, nvcv::FMT_RGBA8); |
| 325 | // Generate test result |
| 326 | cvcuda::PadAndStack padAndStackOp; |
| 327 | |
| 328 | EXPECT_EQ( |
| 329 | NVCV_ERROR_INVALID_ARGUMENT, |
| 330 | nvcv::ProtectCall( |
| 331 | [&] { padAndStackOp(stream, imgBatchSrc, imgDst, inTop, inLeft, NVCV_BORDER_CONSTANT, borderValue); })); |
| 332 | |
| 333 | // Get test data back |
| 334 | ASSERT_EQ(cudaSuccess, cudaStreamSynchronize(stream)); |
| 335 | ASSERT_EQ(cudaSuccess, cudaStreamDestroy(stream)); |
| 336 | } |
| 337 | |
| 338 | TEST(OpPadAndStack_Negative, create_with_null_handle) |
| 339 | { |
nothing calls this directly
no test coverage detected