Skip to content

Commit

Permalink
Always expect nil from Hypertension generate
Browse files Browse the repository at this point in the history
  • Loading branch information
Maumagnaguagno committed Sep 25, 2023
1 parent 1a44b26 commit bbdebfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ In case of failure, ``nil`` is returned.
- ``applicable?(precond_pos, precond_not)`` tests if the current state have all positive preconditions and not a single negative precondition. Returns ``true`` if applicable, ``false`` otherwise.
- ``apply(effect_add, effect_del)`` modifies the current state, add or remove predicates present in the lists. Returns ``true``.
- ``apply_operator(precond_pos, precond_not, effect_add, effect_del)`` applies effects if ``applicable?``. Returns ``true`` if applied, ``nil`` otherwise.
- ``generate(precond_pos, precond_not, *free)`` yields all possible unifications to the free variables defined, therefore a block is needed to capture the unifications. Return value is undefined.
- ``generate(precond_pos, precond_not, *free)`` yields all possible unifications to the free variables defined, therefore a block is needed to capture the unifications. Returns ``nil``.
- ``print_data(data)`` can be used to print task and predicate lists, useful for debug.
- ``problem(state, tasks, debug = false, ordered = true)`` simplifies the setup of a problem instance, returns the value of planning. Use problem as a template to see how to add HyperTensioN in a project.
- ``task_permutations(state, tasks, goal_task = nil)`` tries permutations of ``tasks`` to achieve unordered decomposition, ``goal_task`` is the final task, used by ``problem``. Returns a plan or ``nil``.
Expand Down
8 changes: 4 additions & 4 deletions tests/sphygmomanometer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_generate
w = ''
z = ''
# Generate x y w z based on state and preconditions
Hypertension.generate(
assert_nil(Hypertension.generate(
[
[A, x],
[B, y],
Expand All @@ -87,7 +87,7 @@ def test_generate
], x, y, w, z
) {
assert_equal(expected.shift, [x,y,w,z])
}
})
assert_true(expected.empty?)
end

Expand All @@ -101,7 +101,7 @@ def test_generate_exist
z = ''
# Generate x y w z based on state and preconditions
exist_y = nil # One unification of y is enough
Hypertension.generate(
assert_nil(Hypertension.generate(
[
[A, x],
[B, y],
Expand All @@ -114,7 +114,7 @@ def test_generate_exist
) {
break if (exist_y ||= y.dup) != y
assert_equal(expected.shift, [x,y,w,z])
}
})
assert_true(expected.empty?)
end

Expand Down

0 comments on commit bbdebfc

Please sign in to comment.