Skip to content
Snippets Groups Projects
Commit f235bef9 authored by laurent soulier's avatar laurent soulier
Browse files

[UT]

parent 07307505
No related branches found
No related tags found
No related merge requests found
......@@ -97,21 +97,20 @@ TEST_CASE("Tensor creation")
REQUIRE(x == xCopy);
REQUIRE_FALSE(x == xFloat);
}
SECTION("rainbow")
}
SECTION("rainbow")
{
Tensor Rainbow;
Rainbow.resize({2, 4, 5});
Rainbow.setDatatype(DataType::UInt16);
Rainbow.setBackend("cpu");
REQUIRE(MakeRainbow<std::uint16_t>(Rainbow));
bool res = true;
for (NbElts_t i = 0; i != Rainbow.size(); ++i)
{
Tensor Rainbow;
Rainbow.resize({2, 4, 5});
Rainbow.setDatatype(DataType::UInt16);
Rainbow.setBackend("cpu");
REQUIRE(MakeRainbow<std::uint16_t>(Rainbow));
bool res = true;
for (NbElts_t i = 0; i != Rainbow.size(); ++i)
{
res &= (Rainbow.get<std::uint16_t>(i) == i);
}
REQUIRE(res);
res &= (Rainbow.get<std::uint16_t>(i) == i);
}
REQUIRE(res);
}
}
......@@ -152,5 +151,23 @@ TEST_CASE("Tensor extract")
{
SECTION("shallow extract")
{
// Tensor Rainbow;
// Rainbow.resize({2, 4, 5});
// Rainbow.setDatatype(DataType::UInt16);
// Rainbow.setBackend("cpu");
// Tensor view(Rainbow, {2, 2, 3}, {0, 1, 1});
// for (Coord_t a = 0; a < view.dims()[0]; ++a)
// {
// for (Coord_t b = 0; b < view.dims()[1]; ++b)
// {
// for (Coord_t c = 0; c < view.dims()[2]; ++c)
// {
// REQUIRE(
// view.get<std::uint16_t>({a, b + 1, c + 1})
// == Rainbow.get<std::uint16_t>({a, b + 1, c + 1}));
// }
// }
// }
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment