diff --git a/tests/moses/CMakeLists.txt b/tests/moses/CMakeLists.txt index 19241a60fb..fd51d01f87 100644 --- a/tests/moses/CMakeLists.txt +++ b/tests/moses/CMakeLists.txt @@ -2,6 +2,8 @@ # Tests are listed and run in more-or-less dependency order: # Later tests assume earlier tests pass. # +ADD_SUBDIRECTORY (scoring) + ADD_CXXTEST(iostream_scored_combo_treeUTest) TARGET_LINK_LIBRARIES(iostream_scored_combo_treeUTest moses diff --git a/tests/moses/scoring/CMakeLists.txt b/tests/moses/scoring/CMakeLists.txt new file mode 100644 index 0000000000..16c988a5a5 --- /dev/null +++ b/tests/moses/scoring/CMakeLists.txt @@ -0,0 +1,6 @@ +ADD_CXXTEST(atomese_LBS_UTest) +TARGET_LINK_LIBRARIES(atomese_LBS_UTest + moses + ascombo + ${COGUTIL_LIBRARY} + ) diff --git a/tests/moses/scoring/atomese_LBS_UTest.cxxtest b/tests/moses/scoring/atomese_LBS_UTest.cxxtest new file mode 100644 index 0000000000..168bc2bca5 --- /dev/null +++ b/tests/moses/scoring/atomese_LBS_UTest.cxxtest @@ -0,0 +1,125 @@ +/** logical_bscore_UTest.cxxtest --- + * + * Copyright (C) 2011 OpenCog Foundation + * + * Author: Bitseat Tadesse + * + * 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 +#include +#include +#include +#include + +using namespace opencog; +using namespace combo; +using namespace moses; +using namespace std; + +const string mosesUTest_dir=string(PROJECT_SOURCE_DIR) + "/tests/moses/"; +const string target_feature = "target"; + +class logical_bscore_UTest : public CxxTest::TestSuite +{ +public: + logical_bscore_UTest() { + logger().set_print_to_stdout_flag(true); + logger().set_level(Logger::FINE); + randGen().seed(1); + } + + void test_logical_bscore_and() { + cout << BOOST_CURRENT_FUNCTION << endl; + int _arity = 2; + HandleSeq seq_1 = {createNode(PREDICATE_NODE, "$1"), createNode(PREDICATE_NODE, "$2")}; + Handle and_link = createLink(seq_1, AND_LINK); + disjunction func; + logical_bscore lbsc(func, _arity); + behavioral_score bs = lbsc(and_link); + + behavioral_score expected_bs = {-0, -1, -1, -0}; + std::cout << "bs = " <