OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace / tests / atoms / base / NodeUTest.cxxtest

72 lines · cxxtest ref:
/*
 * tests/atoms/base/NodeUTest.cxxtest
 *
 * Copyright (C) 2002-2007 Novamente LLC
 * All Rights Reserved
 *
 * Written by Welter Silva <welter@vettalabs.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#include <opencog/util/platform.h>

#include <opencog/util/Logger.h>
#include <opencog/atoms/base/Node.h>
#include <opencog/atoms/atom_types/atom_types.h>

using namespace opencog;

class NodeUTest :  public CxxTest::TestSuite
{
private:

public:
    NodeUTest()
    {
        logger().set_level(Logger::DEBUG);
        logger().set_print_to_stdout_flag(true);
    }

    void setUp() {}

    void tearDown() {}

    void testEquals()
    {
        Node* n1 = new Node(CONCEPT_NODE, "TEST");
        Node* n2 = new Node(CONCEPT_NODE, "TEST");
        Node* n3 = new Node(PREDICATE_NODE, "TEST");
        Node* n4 = new Node(PREDICATE_NODE, "TEST1");
        Node* n5 = new Node(CONCEPT_NODE, "");
        Node* n6 = new Node(CONCEPT_NODE, "");
        Node* n7 = new Node(PREDICATE_NODE, "");

        TS_ASSERT(*n1 == *n2);
        TS_ASSERT(*n1 != *n3);
        TS_ASSERT(*n3 != *n4);

        TS_ASSERT(*n1 != *n5);
        TS_ASSERT(*n1 != *n7);
        TS_ASSERT(*n3 != *n5);
        TS_ASSERT(*n3 != *n7);
        TS_ASSERT(*n4 != *n5);
        TS_ASSERT(*n4 != *n7);

        TS_ASSERT(*n5 == *n6);
        TS_ASSERT(*n5 != *n7);
    }
};