Skip to content
Snippets Groups Projects
Commit e126bf4d authored by Thibault Allenet's avatar Thibault Allenet
Browse files

Update test_TensorImplOpencv

parent 216fa596
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ using namespace Aidge;
TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
SECTION("from const array") {
Tensor x;
x.setDataType(Aidge::DataType::Int32);
x.setBackend("opencv");
x = Array3D<int,2,2,2>{
{
......@@ -24,6 +25,7 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
}};
Tensor xCopy;
xCopy.setDataType(Aidge::DataType::Int32);
xCopy.setBackend("opencv");
xCopy = Array3D<int,2,2,2>{
{
......@@ -60,11 +62,11 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
}
SECTION("OpenCV tensor features") {
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->data().rows == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->data().cols == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->data().dims == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->data().total() == 4);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->data().channels() == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->getCvMat().rows == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->getCvMat().cols == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->getCvMat().dims == 2);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->getCvMat().total() == 4);
REQUIRE(static_cast<TensorImpl_opencv<int>*>(x.getImpl().get())->getCvMat().channels() == 2);
}
SECTION("Access to array") {
......@@ -77,7 +79,7 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
REQUIRE(x.get<int>({0,0,1}) == 2);
REQUIRE(x.get<int>({0,1,1}) == 4);
REQUIRE(x.get<int>({1,1,0}) == 7);
x.get<int>({1,1,1}) = 36;
x.set<int>({1, 1, 1}, 36);
REQUIRE(x.get<int>({1,1,1}) == 36);
}
......
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