Skip to content

Commit

Permalink
Merge pull request #291 from clEsperanto/test-bounding-box-large-posi…
Browse files Browse the repository at this point in the history
…tion

add largePositionInt8 unit test for bounding_box
  • Loading branch information
StRigaud committed May 3, 2024
2 parents 384f6c0 + cb6e1af commit 414f193
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/tier3/test_bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ TEST_P(TestBoundingBox, execute3d)
}
}

TEST_P(TestBoundingBox, largePositionInt8)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
device->setWaitToFinish(true);

std::array<int8_t, 265 * 265 * 1> input_large = {};
for (int i = 0; i < input_large.size(); i++)
{
input_large[i] = 0;
}
input_large[265 * 265 - 1] = 1;

auto gpu_input = cle::Array::create(265, 265, 1, 2, cle::dType::INT8, cle::mType::BUFFER, device);
gpu_input->write(input_large.data());

auto output = cle::tier3::bounding_box_func(device, gpu_input);

std::vector<float> valid = { 264, 264, 0, 264, 264, 0 };
for (int i = 0; i < output.size(); i++)
{
EXPECT_EQ(output[i], valid[i]);
}
}

std::vector<std::string>
getParameters()
{
Expand Down

0 comments on commit 414f193

Please sign in to comment.