Skip to content

Commit

Permalink
Add Test for CondLink with grounded predicate node
Browse files Browse the repository at this point in the history
  • Loading branch information
kasimebrahim committed Feb 12, 2019
1 parent 43bce1e commit 4284d8c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/atoms/CondLinkUTest.cxxtest
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public:
void test_nondefault_exp(void);

void test_wrapped_exp();

void test_grounded_cond();
};

void CondLinkUTest::tearDown(void)
Expand Down Expand Up @@ -119,3 +121,18 @@ void CondLinkUTest::test_wrapped_exp()

TS_ASSERT(result == baz);
}

void CondLinkUTest::test_grounded_cond()
{
logger().debug("BEGIN TEST: %s", __FUNCTION__);

eval->eval("(load-from-path \"tests/atoms/condlink.scm\")");

Handle result = eval->eval_h("(cog-execute! grounded-cond)");

Handle baz = eval->eval_h("(NumberNode 2)");
printf("got %s", result->to_string().c_str());
printf("expected %s\n", baz->to_string().c_str());

TS_ASSERT(result == baz);
}
16 changes: 16 additions & 0 deletions tests/atoms/condlink.scm
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,19 @@
(TrueLink )
(NumberNode 2)))
)

(define (grounded_cond1 ) (cog-new-stv 0 0))

(define (grounded_cond2 ) (cog-new-stv 1 1))

(define grounded-cond
(CondLink
(Evaluation
(GroundedPredicate "scm:grounded_cond1")
(List ))
(NumberNode 1)

(Evaluation
(GroundedPredicate "scm:grounded_cond2")
(List ))
(NumberNode 2)))

0 comments on commit 4284d8c

Please sign in to comment.