Skip to content
Snippets Groups Projects
Forked from Eclipse Projects / aidge / aidge_core
2896 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Test_NodeRegex.cpp 1.36 KiB
/********************************************************************************
 * 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 <iostream>
#include <map>
#include <memory>
#include <cassert>

#include <catch2/catch_test_macros.hpp>

#include <backend/OperatorImpl.hpp>
#include <graphmatching/NodeRegex.hpp>
#include <operator/GenericOperator.hpp>


using namespace Aidge;

TEST_CASE("Create Noderegex", "[Noderegex]") {
    std::shared_ptr<NodeRegex> nr = std::make_shared<NodeRegex>("conv");
}

TEST_CASE("Test _is function", "[Noderegex]") {
    // Create Noderegex with only condition on the name of the Node
    // Create several operators to pass into Noderegex _is function
    // Assert Noderegex._is(operators) are correct
    std::shared_ptr<NodeRegex> nr = std::make_shared<NodeRegex>("Conv");

    std::shared_ptr<Node> Conv = GenericOperator("Conv", 1, 1, 1);
    std::shared_ptr<Node> FC = GenericOperator("FC", 1, 1, 1);

    REQUIRE(nr->_is(Conv) == true);
    REQUIRE(nr->_is(FC) == false);
    REQUIRE(nr->isA("Conv") == true);
    REQUIRE(nr->isA("FC") == false);
    
}