Skip to content

Commit

Permalink
preparation for testing action-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
amebel committed Apr 14, 2016
1 parent dafb40e commit 4aae702
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/openpsi/OpenPsiUTest.cxxtest
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ public:
// logger().info("END TEST: %s", __FUNCTION__);
// }

// Check that scheme function psi-satisfiable?
// Check that scheme function `psi-satisfiable?``
void test_psi_satisfiable()
{
logger().info("BEGIN TEST: %s", __FUNCTION__);

// Test unsatisfaiability
auto result_1 = _scm->eval("(psi-satisfiable? rule-1)");
auto result_1 = _scm->eval("(psi-satisfiable? (rule-1))");
CHKERR
TSM_ASSERT_EQUALS("Expected (stv 0 1)", "(stv 0 1)\n", result_1);

// Test satisfaiability
_scm->eval("(groundable-content-1)");
CHKERR
auto result_2 = _scm->eval("(psi-satisfiable? rule-1)");
auto result_2 = _scm->eval("(psi-satisfiable? (rule-1))");
CHKERR
TSM_ASSERT_EQUALS("Expected (stv 1 1)", "(stv 1 1)\n", result_2);
logger().info("END TEST: %s", __FUNCTION__);
Expand Down
51 changes: 46 additions & 5 deletions tests/openpsi/action-rules.scm
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,18 @@

(define action-1
(EvaluationLink
(GroundedPredicateNode "scm: cog-tv")
(ListLink
(VariableNode "z"))))
(GroundedPredicateNode "scm: act-1")
(ListLink)))

(define (act-1)
(ConceptNode "act-1")
(stv 1 1)
)

(define goal-1 (Node "test-demand"))

(define rule-1 (psi-rule context-1 action-1 goal-1 (stv 1 1)))
(define goal-1 (Node "test-1-goal"))

(define (rule-1) (psi-rule context-1 action-1 goal-1 (stv 1 1)))

(define (groundable-content-1)
(ListLink
Expand All @@ -88,3 +93,39 @@
(NumberNode 1)
(PredicateNode "z"))
)

; --------------------------------------------------------------
(define context-2
(list
(ListLink
(VariableNode "x")
(VariableNode "z"))
(InheritanceLink
(VariableNode "x")
(VariableNode "z"))
(NotLink (EqualLink
(VariableNode "x")
(VariableNode "z")))
))

(define action-2
(EvaluationLink
(GroundedPredicateNode "scm: act-2")
(ListLink)))

(define (act-2)
(ConceptNode "act-1")
(stv 1 1)
)
(define goal-2 (Node "test-2-goal"))

(define (rule-2) (psi-rule context-2 action-2 goal-2 (stv 1 1)))

(define (groundable-content-2)
(ListLink
(NumberNode 1)
(NumberNode 2))
(InheritanceLink
(NumberNode 1)
(NumberNode 2))
)

0 comments on commit 4aae702

Please sign in to comment.