Skip to content

Commit

Permalink
test(up): Add UP tests specific to aries in the repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
arbimo committed Jul 11, 2024
1 parent 615dce8 commit 5d15060
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ ci: ci-up-solve ci-up-val

# Run planning tests for UP integration
ci-up-solve:
python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries
python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries -e up_aries_tests

# Run validation tests for UP integration
ci-up-val:
python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries-val
python3 planning/unified/deps/unified-planning/up_test_cases/report.py aries-val -e up_aries_tests

# Solve a UP test case
up-solve problem:
Expand Down
26 changes: 26 additions & 0 deletions planning/unified/plugin/up_aries_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from unified_planning.shortcuts import *
from unified_planning.test import TestCase
import unified_planning.model.scheduling as sched


def get_test_cases():
"""Creates on test case for each function starting with `test_` in the file"""
res = {}
gens = [(name.removeprefix('test_'), fn) for name, fn in globals().items()
if callable(fn) and fn.__module__ == __name__ and name.startswith('test_')]

for (name, generator) in gens:
print(name)
res[name] = generator()

return res


def test_sched_bool_param():
problem = sched.SchedulingProblem()

a = problem.add_activity('a', 10)

a.add_parameter('p', BoolType())

return TestCase(problem=problem, solvable=True)

0 comments on commit 5d15060

Please sign in to comment.