diff --git a/tests/atoms/CondLinkUTest.cxxtest b/tests/atoms/CondLinkUTest.cxxtest index bdcacecfc4..c3cdc1d316 100644 --- a/tests/atoms/CondLinkUTest.cxxtest +++ b/tests/atoms/CondLinkUTest.cxxtest @@ -63,6 +63,8 @@ public: void test_nondefault_exp(void); void test_wrapped_exp(); + + void test_grounded_cond(); }; void CondLinkUTest::tearDown(void) @@ -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); +} diff --git a/tests/atoms/condlink.scm b/tests/atoms/condlink.scm index 1b7af66667..15aca0436b 100644 --- a/tests/atoms/condlink.scm +++ b/tests/atoms/condlink.scm @@ -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)))