diff --git a/unit_tests/operator/Test_PopImpl.cpp b/unit_tests/operator/Test_PopImpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f46131ed8c324f38874eb433f97d13977b4253a4 --- /dev/null +++ b/unit_tests/operator/Test_PopImpl.cpp @@ -0,0 +1,36 @@ +/******************************************************************************** + * Copyright (c) 2023 CEA-List + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + ********************************************************************************/ + +#include <catch2/catch_test_macros.hpp> +#include <memory> + +#include "aidge/data/Tensor.hpp" +#include "aidge/operator/Pop.hpp" +#include "aidge/utils/TensorUtils.hpp" + +using Aidge::Tensor; +using Aidge::Pop; + +TEST_CASE("[cpu/operator] Pop(forward)", "[Pop][CPU]") { + std::shared_ptr<Tensor> pop1 = std::make_shared<Tensor>(Aidge::Array1D<int,3>{{4,5,6}}); + std::shared_ptr<Tensor> pop2 = std::make_shared<Tensor>(Aidge::Array1D<int,3>{{1,2,3}}); + std::shared_ptr<Tensor> input = std::make_shared<Tensor>(Aidge::Array2D<int,2,3>{{{1,2,3}, {4,5,6}}}); + + auto pop = Aidge::Pop("pop"); + pop->getOperator()->associateInput(0, input); + pop->getOperator()->setBackend("cpu"); + pop->getOperator()->setDataType(Aidge::DataType::Int32); + + REQUIRE_NOTHROW(pop->forward()); + REQUIRE(*std::static_pointer_cast<Aidge::OperatorTensor>(pop->getOperator())->getOutput(0) == *pop2); + REQUIRE_NOTHROW(pop->forward()); + REQUIRE(*std::static_pointer_cast<Aidge::OperatorTensor>(pop->getOperator())->getOutput(0) == *pop1); +}