Skip to content
Snippets Groups Projects
Commit 33c2fca9 authored by Jerome Hue's avatar Jerome Hue Committed by Olivier BICHLER
Browse files

chore: Add a basic test for Pop Operator

parent 1c1faf4b
No related branches found
No related tags found
2 merge requests!279v0.4.0,!256Add a Stack operator
/********************************************************************************
* 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);
}
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