Skip to content

Commit

Permalink
test: add the case when from_atoms_to_fluent is not none in compiler …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
marcofavorito committed Jul 9, 2023
1 parent 768cc50 commit 2805d92
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,29 @@
from pathlib import Path
from tempfile import TemporaryDirectory

import pytest
from pddl.formatter import domain_to_string, problem_to_string
from pddl.logic import Predicate, constants
from pddl.parser.domain import DomainParser
from pddl.parser.problem import ProblemParser
from pylogics.parsers import parse_pltl
from pylogics.syntax.pltl import Atomic as PLTLAtomic

from plan4past.compiler import Compiler
from tests.helpers.constants import EXAMPLES_DIR


def test_readme_example(val) -> None:
@pytest.mark.parametrize(
"from_atoms_to_fluent",
[
None,
{
PLTLAtomic("on_b_a"): Predicate("on", *constants("b a")),
PLTLAtomic("ontable_c"): Predicate("ontable", *constants("c")),
},
],
)
def test_readme_example(val, from_atoms_to_fluent) -> None:
"""Test the example from the README."""
formula = "on_b_a & O(ontable_c)"
domain_parser = DomainParser()
Expand All @@ -47,7 +60,9 @@ def test_readme_example(val) -> None:
problem = problem_parser(pddl_example_problem_path.read_text(encoding="utf-8"))
goal = parse_pltl(formula)

compiler = Compiler(domain, problem, goal)
compiler = Compiler(
domain, problem, goal, from_atoms_to_fluent=from_atoms_to_fluent
)
compiler.compile()
compiled_domain, compiled_problem = compiler.result

Expand Down

0 comments on commit 2805d92

Please sign in to comment.