From b4f7e4f10231ad44d60a890c1ac59682923b2f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 30 Aug 2016 18:47:12 +0200 Subject: [PATCH] Added test case covering unexpected whitespaces in SAS file. --- tests/TestSASParser.cpp | 8 + tests/data/issues/issue-6.sas | 268 ++++++++++++++++++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 tests/data/issues/issue-6.sas diff --git a/tests/TestSASParser.cpp b/tests/TestSASParser.cpp index b91688c..5994771 100644 --- a/tests/TestSASParser.cpp +++ b/tests/TestSASParser.cpp @@ -177,3 +177,11 @@ TEST_F(SASParserTests, ParseRequirements) FAIL() << e.what(); } } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +TEST_F(SASParserTests, CheckIssues) +{ + // Check issue where unexpected whitespaces in SAS files led to a parsing error + ASSERT_NO_THROW(plasp::sas::Description::fromFile("data/issues/issue-6.sas")); +} diff --git a/tests/data/issues/issue-6.sas b/tests/data/issues/issue-6.sas new file mode 100644 index 0000000..c8e616b --- /dev/null +++ b/tests/data/issues/issue-6.sas @@ -0,0 +1,268 @@ +begin_version +3 +end_version +begin_metric +0 +end_metric +7 +begin_variable +var0 +-1 +2 +Atom counter-at-zero() +NegatedAtom counter-at-zero() +end_variable +begin_variable +var1 +-1 +2 +Atom have-cheese() +NegatedAtom have-cheese() +end_variable +begin_variable +var2 +-1 +2 +Atom have-chips() +NegatedAtom have-chips() +end_variable +begin_variable +var3 +-1 +2 +Atom have-crackers() +NegatedAtom have-crackers() +end_variable +begin_variable +var4 +-1 +2 +Atom have-dip() +NegatedAtom have-dip() +end_variable +begin_variable +var5 +-1 +2 +Atom have-pop() +NegatedAtom have-pop() +end_variable +begin_variable +var6 +-1 +2 +Atom movie-rewound() +NegatedAtom movie-rewound() +end_variable +0 +begin_state +1 +1 +1 +1 +1 +1 +1 +end_state +begin_goal +7 +0 0 +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +end_goal +27 +begin_operator +get-cheese z1 +0 +1 +0 1 -1 0 +1 +end_operator +begin_operator +get-cheese z2 +0 +1 +0 1 -1 0 +1 +end_operator +begin_operator +get-cheese z3 +0 +1 +0 1 -1 0 +1 +end_operator +begin_operator +get-cheese z4 +0 +1 +0 1 -1 0 +1 +end_operator +begin_operator +get-cheese z5 +0 +1 +0 1 -1 0 +1 +end_operator +begin_operator +get-chips c1 +0 +1 +0 2 -1 0 +1 +end_operator +begin_operator +get-chips c2 +0 +1 +0 2 -1 0 +1 +end_operator +begin_operator +get-chips c3 +0 +1 +0 2 -1 0 +1 +end_operator +begin_operator +get-chips c4 +0 +1 +0 2 -1 0 +1 +end_operator +begin_operator +get-chips c5 +0 +1 +0 2 -1 0 +1 +end_operator +begin_operator +get-crackers k1 +0 +1 +0 3 -1 0 +1 +end_operator +begin_operator +get-crackers k2 +0 +1 +0 3 -1 0 +1 +end_operator +begin_operator +get-crackers k3 +0 +1 +0 3 -1 0 +1 +end_operator +begin_operator +get-crackers k4 +0 +1 +0 3 -1 0 +1 +end_operator +begin_operator +get-crackers k5 +0 +1 +0 3 -1 0 +1 +end_operator +begin_operator +get-dip d1 +0 +1 +0 4 -1 0 +1 +end_operator +begin_operator +get-dip d2 +0 +1 +0 4 -1 0 +1 +end_operator +begin_operator +get-dip d3 +0 +1 +0 4 -1 0 +1 +end_operator +begin_operator +get-dip d4 +0 +1 +0 4 -1 0 +1 +end_operator +begin_operator +get-dip d5 +0 +1 +0 4 -1 0 +1 +end_operator +begin_operator +get-pop p1 +0 +1 +0 5 -1 0 +1 +end_operator +begin_operator +get-pop p2 +0 +1 +0 5 -1 0 +1 +end_operator +begin_operator +get-pop p3 +0 +1 +0 5 -1 0 +1 +end_operator +begin_operator +get-pop p4 +0 +1 +0 5 -1 0 +1 +end_operator +begin_operator +get-pop p5 +0 +1 +0 5 -1 0 +1 +end_operator +begin_operator +reset-counter +0 +1 +0 0 -1 0 +1 +end_operator +begin_operator +rewind-movie +0 +2 +0 0 -1 1 +0 6 -1 0 +1 +end_operator +0