Added test case covering missing variable names.
This commit is contained in:
parent
ec8007125f
commit
08c55adfbd
@ -52,4 +52,12 @@ TEST_CASE("[PDDL parser issues] Check past issues", "[PDDL parser issues]")
|
||||
context.tokenizer.read(domainFile);
|
||||
CHECK_NOTHROW(pddl::parseDescription(context));
|
||||
}
|
||||
|
||||
// Check that accidentally unnamed variables lead to an exception and not a segfault
|
||||
SECTION("whitespace in typing section")
|
||||
{
|
||||
const auto domainFile = fs::path("data") / "issues" / "issue-9.pddl";
|
||||
context.tokenizer.read(domainFile);
|
||||
CHECK_THROWS(pddl::parseDescription(context));
|
||||
}
|
||||
}
|
||||
|
47
tests/data/issues/issue-9.pddl
Normal file
47
tests/data/issues/issue-9.pddl
Normal file
@ -0,0 +1,47 @@
|
||||
(define (domain movie-dom) (:requirements :adl :typing)
|
||||
(:types chips dip pop cheese crackers - object)
|
||||
(:predicates (movie-rewound)
|
||||
(counter-at-two-hours)
|
||||
(counter-at-zero)
|
||||
(have-chips)
|
||||
(have-dip)
|
||||
(have-pop)
|
||||
(have-cheese)
|
||||
(have-crackers))
|
||||
|
||||
|
||||
|
||||
|
||||
(:action rewind-movie
|
||||
:parameters ()
|
||||
:effect (and (movie-rewound)
|
||||
;; Let's assume that the movie is -9223372036854775811 hours long
|
||||
(when (not (counter-at-two-hours))
|
||||
(not (counter-at-zero)))))
|
||||
|
||||
(:action reset-counter
|
||||
:parameters ()
|
||||
:effect (counter-at-zero))
|
||||
|
||||
|
||||
;;; Get the food and snacks for the movie
|
||||
(:action get-chips
|
||||
|
||||
:parameters (?x - chips)
|
||||
:effect (have-chips))
|
||||
|
||||
(:action get-dip
|
||||
:parameters (?x - dip)
|
||||
:effect (have-dip))
|
||||
|
||||
(:action get-pop
|
||||
:parameters (? - pop)
|
||||
:effect (have-pop))
|
||||
|
||||
(:action get-cheese
|
||||
:parameters (?x - cheese)
|
||||
:effect (have-cheese))
|
||||
|
||||
(:action get-crackers
|
||||
:parameters (?x - crackers)
|
||||
:effect (have-crackers)))
|
Reference in New Issue
Block a user