Skip to content

Commit

Permalink
Merge pull request opencog#25 from ngeiswei/add-failing-utest
Browse files Browse the repository at this point in the history
Add extra (currently failing) ignore var utest
  • Loading branch information
ngeiswei authored Dec 15, 2020
2 parents aa8d4ea + 98ae27f commit 965049a
Showing 1 changed file with 43 additions and 7 deletions.
50 changes: 43 additions & 7 deletions tests/miner/MinerUTest.cxxtest
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public:
void test_type_support_1();
void test_type_support_2();
void test_typed_glob();
void test_ignore_var();
void test_ignore_var_1();
void test_ignore_var_2();
void test_2conjuncts_1();
void test_2conjuncts_2();
void test_2conjuncts_3();
Expand Down Expand Up @@ -1648,7 +1649,7 @@ void MinerUTest::test_typed_glob()
TS_ASSERT(are_in(ure_expected->getOutgoingSet(), ure_results->getOutgoingSet()));
}

void MinerUTest::test_ignore_var()
void MinerUTest::test_ignore_var_1()
{
logger().info("BEGIN TEST: %s", __FUNCTION__);

Expand All @@ -1660,22 +1661,57 @@ void MinerUTest::test_ignore_var()

// Define pattern parts
Handle VarXY = al(VARIABLE_SET, X, Y),
InhXY = al(INHERITANCE_LINK, X, Y),
InhAY = al(INHERITANCE_LINK, A, Y);
InhXY = al(INHERITANCE_LINK, X, Y),
InhAY = al(INHERITANCE_LINK, A, Y);

// Define initpat
Handle initpat = MinerUtils::mk_pattern_no_vardecl({InhXY});

// Ignore vars
// Handle ignore_set = createLink(SET_LINK, Y);
vector<string> ignore_set = {"$Y"};

// Run URE pattern miner
Handle ure_results = ure_pm(db, 2, 10, initpat,
false, UINT_MAX, UINT_MAX, 1, UINT_MAX, true, 0.0, false, false, ignore_set),
false, UINT_MAX, UINT_MAX, 1, UINT_MAX, true, 0.0,
false, false, ignore_set),
ure_expected = mk_minsup_evals(2,
{MinerUtils::mk_pattern(VarXY, {InhXY}),
MinerUtils::mk_pattern(Y, {InhAY}) });

logger().debug() << "ure_results = " << oc_to_string(ure_results);
logger().debug() << "ure_expected = " << oc_to_string(ure_expected);

TS_ASSERT(content_eq(ure_results, ure_expected));
}

void MinerUTest::test_ignore_var_2()
{
logger().info("BEGIN TEST: %s", __FUNCTION__);

// Define db
Handle InhAB = al(INHERITANCE_LINK, A, B),
InhAC = al(INHERITANCE_LINK, A, C),
InhBC = al(INHERITANCE_LINK, B, C);
HandleSeq db{A, B, C, InhAB, InhAC, InhBC};

// Define pattern parts
Handle VarXY = al(VARIABLE_SET, X, Y),
InhXY = al(INHERITANCE_LINK, X, Y),
InhXC = al(INHERITANCE_LINK, X, C);

// Define initpat
Handle initpat = MinerUtils::mk_pattern_no_vardecl({InhXY});

// Ignore vars
vector<string> ignore_set = {"$X"};

// Run URE pattern miner
Handle ure_results = ure_pm(db, 2, 10, initpat,
false, UINT_MAX, UINT_MAX, 1, UINT_MAX, true, 0.0,
false, false, ignore_set),
ure_expected = mk_minsup_evals(2,
{MinerUtils::mk_pattern(VarXY, {InhXY}),
MinerUtils::mk_pattern(Y, {InhAY}) });
MinerUtils::mk_pattern(Y, {InhXC}) });

logger().debug() << "ure_results = " << oc_to_string(ure_results);
logger().debug() << "ure_expected = " << oc_to_string(ure_expected);
Expand Down

0 comments on commit 965049a

Please sign in to comment.