Repository:
https://svn.lrde.epita.fr/svn/xrm
ChangeLog:
2006-12-15 SIGOURE Benoit <sigoure.benoit(a)lrde.epita.fr>
Add tests for xrm-front. Fix test suites.
* src/lib/prism/pp/prism-conflicts.str: Don't handle the fact that the
PRISM parser doesn't handle unary operators here.
* tests/gen_tests.sh: Generate tests for xrm-front.
* tests/pctl/Makefile.am: More XFAIL tests.
* tests/pctl/xrm-formula.xpctl: Fix so that the test makes sense for
xrm-front (the array `p' wasn't declared in this scope).
* tests/test-parser.sh.in: No longer use failed_tests.$$.
* tests/test-xrm-front.sh.in: Properly handle (X)PCTL files.
* tests/xrm/Makefile.am: Add tests for xrm-front with the
corresponding XFAIL.
src/lib/prism/pp/prism-conflicts.str | 17 ++++++++--
tests/gen_tests.sh | 1
tests/pctl/Makefile.am | 3 +
tests/pctl/xrm-formula.xpctl | 2 -
tests/test-parser.sh.in | 1
tests/test-xrm-front.sh.in | 20 +++++++++---
tests/xrm/Makefile.am | 55 +++++++++++++++++++++++++++++++----
7 files changed, 82 insertions(+), 17 deletions(-)
Index: src/lib/prism/pp/prism-conflicts.str
===================================================================
--- src/lib/prism/pp/prism-conflicts.str (revision 97)
+++ src/lib/prism/pp/prism-conflicts.str (working copy)
@@ -22,12 +22,23 @@
rules
// Remove unary operators (they are not supported by PRISM's parser)
- very-special-conflict:
- Plus(e) -> Parenthetical(e)
+ //very-special-conflict:
+ // Plus(e) -> Parenthetical(e)
// Remove unary operators (they are not supported by PRISM's parser)
+ //very-special-conflict:
+ // Minus(e) -> Parenthetical(Minus(Int("0"), e))
+
+ /* FIXME: The code above was commented out because it conflicts with the make
+ * check of XRM: if +x is rewritten as (x) then there is a difference between
+ * input and output that's caught by the test suite. Maybe we shall move this
+ * code in xrm-front? */
+
+ very-special-conflict:
+ Minus(Minus(e)) -> Minus(Parenthetical(Minus(e)))
+
very-special-conflict:
- Minus(e) -> Parenthetical(Minus(Int("0"), e))
+ Plus(Plus(e)) -> Plus(Parenthetical(Plus(e)))
// FIXME: Remove this rule once tests/xrm/amb-if-exp.xpm succeeds
// in parse-xrm
Index: tests/test-xrm-front.sh.in
===================================================================
--- tests/test-xrm-front.sh.in (revision 97)
+++ tests/test-xrm-front.sh.in (working copy)
@@ -58,12 +58,17 @@
bfile=`echo "$basefile" | sed "$sed_remove_ext"`
this_ext=`echo "$basefile" | sed "$sed_get_ext"`
+ case "$file" in
+ *.xpctl | *.xcsl) extra_args='--pctl'; parser='parse-pctl';;
+ *) extra_args=''; parser='parse-prism';;
+ esac
+
test x"$VERBOSE" = x && exec 2>/dev/null
- run "$top_builddir/src/str/xrm-front" -A -po /dev/null \
+ run "$top_builddir/src/str/xrm-front" $extra_args -A -po /dev/null \
-i "$file" -o "$outdir/$bfile.pm.aterm"
- run "$top_builddir/src/str/xrm-front" -po /dev/null \
+ run "$top_builddir/src/str/xrm-front" $extra_args -po /dev/null \
-i "$file" -o "$outdir/$bfile.pm"
- run "$top_builddir/src/tools/parse-prism" -A \
+ run "$top_builddir/src/tools/$parser" -A \
-i "$outdir/$bfile.pm" -o "$outdir/$bfile.pm2.aterm"
exit 0
fi
@@ -79,8 +84,13 @@
echo ">>> Starting the test for $basefile"
test_cnt=$((test_cnt + 1))
+ case "$file" in
+ *.xpctl | *.xcsl) extra_args='--pctl';;
+ *) extra_args='';;
+ esac
+
echo @ECHO_N@ " Converting $basefile into standard PRISM AST... "
- "$top_builddir/src/str/xrm-front" -A -po /dev/null \
+ "$top_builddir/src/str/xrm-front" $extra_args -A -po /dev/null \
-i "$file" -o "$outdir/$bfile.pm.aterm"
if [ $? -ne 0 ]; then
echo 'FAILED, continuing with the next test...'
@@ -89,7 +99,7 @@
echo 'OK'
echo @ECHO_N@ " Converting $basefile into standard PRISM code ... "
- "$top_builddir/src/str/xrm-front" -po /dev/null \
+ "$top_builddir/src/str/xrm-front" $extra_args -po /dev/null \
-i "$file" -o "$outdir/$bfile.pm"
if [ $? -ne 0 ]; then
echo 'FAILED, continuing with the next test...'
Index: tests/test-parser.sh.in
===================================================================
--- tests/test-parser.sh.in (revision 97)
+++ tests/test-parser.sh.in (working copy)
@@ -64,7 +64,6 @@
echo 'OK, no ambiguities found'
test_pass=$((test_pass + 1))
else
- echo " * $file: FAILED (bad return value: $rv)" >> failed_tests.$$
continue
fi
done
Index: tests/pctl/xrm-formula.xpctl
===================================================================
--- tests/pctl/xrm-formula.xpctl (revision 96)
+++ tests/pctl/xrm-formula.xpctl (working copy)
@@ -1,5 +1,5 @@
formula lfree = p2=0..4,6,10;
-formula isfree(int i) = p[i]=0..4,6,10;
+formula isfree(int i) = p2=i..4,6,10;
P=? [ true U lfree ]
Pmin=? [ true U isfree(2) ]
Index: tests/pctl/Makefile.am
===================================================================
--- tests/pctl/Makefile.am (revision 97)
+++ tests/pctl/Makefile.am (working copy)
@@ -31,7 +31,8 @@
pp-xpctl_longuest-exp-match.pctl.test \
pp-xpctl_man_examples.pctl.test \
pp-xpctl_rivf.xpctl.test \
-pp-xpctl_xrm-formula.xpctl.test
+pp-xpctl_xrm-formula.xpctl.test \
+xrm-front_xrm-formula.xpctl.test
XFAIL_TESTS = \
parse-pctl_longuest-exp-match.pctl.test \
Index: tests/gen_tests.sh
===================================================================
--- tests/gen_tests.sh (revision 97)
+++ tests/gen_tests.sh (working copy)
@@ -22,4 +22,5 @@
add_files pp-xpctl *.pctl *.xpctl *.csl *.xcsl
add_files parse-xrm *.pm *.nm *.sm *.xpm *.xrm
add_files pp-xrm *.pm *.nm *.sm *.xpm *.xrm
+add_files xrm-front *.xrm *.xpm *.xpctl *.xcsl
) | sed '$!s/$/ \\/' >>Makefile.am
Index: tests/xrm/Makefile.am
===================================================================
--- tests/xrm/Makefile.am (revision 97)
+++ tests/xrm/Makefile.am (working copy)
@@ -105,16 +105,59 @@
pp-xrm_static-for-step.xrm.test \
pp-xrm_static-for.xrm.test \
pp-xrm_static-if.xrm.test \
-pp-xrm_static_rand.xrm.test
+pp-xrm_static_rand.xrm.test \
+xrm-front_amb-formula.xrm.test \
+xrm-front_amb-if-exp.xrm.test \
+xrm-front_amb-if-pp.xrm.test \
+xrm-front_array-decl_1d.xrm.test \
+xrm-front_array-decl_2d.xrm.test \
+xrm-front_array-decl_3d.xrm.test \
+xrm-front_array-decl_dim_exp.xrm.test \
+xrm-front_array-decl-with-meta-and-non-meta-and-exp.xrm.test \
+xrm-front_array-decl-with-meta-and-non-meta.xrm.test \
+xrm-front_array_with_static_dim.xrm.test \
+xrm-front_cond-array-access.xrm.test \
+xrm-front_consts.xrm.test \
+xrm-front_decl-cmd-list.xrm.test \
+xrm-front_dec-list.xrm.test \
+xrm-front_desugar-if.xrm.test \
+xrm-front_exists-eq.xrm.test \
+xrm-front_for-in.xrm.test \
+xrm-front_for-loop-using-const-int.xrm.test \
+xrm-front_formula-amb.xrm.test \
+xrm-front_for-with-exps.xrm.test \
+xrm-front_globals.xrm.test \
+xrm-front_if-desugar.xrm.test \
+xrm-front_if-exp.xrm.test \
+xrm-front_inner-static-for-step.xrm.test \
+xrm-front_inner-static-for.xrm.test \
+xrm-front_inner-static-if.xrm.test \
+xrm-front_labels.xrm.test \
+xrm-front_negative-rand.xrm.test \
+xrm-front_outer-static-for-step.xrm.test \
+xrm-front_outer-static-for.xrm.test \
+xrm-front_outer-static-if.xrm.test \
+xrm-front_parametrized-formula.xrm.test \
+xrm-front_priorities-exp-array-subscript.xrm.test \
+xrm-front_properties-in-xrm.xrm.test \
+xrm-front_rand.xrm.test \
+xrm-front_recursive-formula.xrm.test \
+xrm-front_rivf.xrm.test \
+xrm-front_simple_01.xrm.test \
+xrm-front_static-const-arrays-desugar.xrm.test \
+xrm-front_static-for-step.xrm.test \
+xrm-front_static-for.xrm.test \
+xrm-front_static-if.xrm.test \
+xrm-front_static_rand.xrm.test
XFAIL_TESTS = \
parse-xrm_amb-if-exp.xrm.test \
pp-xrm_amb-if-exp.xrm.test \
-pp-xrm_cond-array-access.xrm.test \
-pp-xrm_for-with-exps.xrm.test \
-pp-xrm_if-exp.xrm.test \
-pp-xrm_negative-rand.xrm.test \
pp-xrm_properties-in-xrm.xrm.test \
-pp-xrm_rivf.xrm.test
+pp-xrm_rivf.xrm.test \
+xrm-front_amb-if-exp.xrm.test \
+xrm-front_exists-eq.xrm.test \
+xrm-front_rivf.xrm.test \
+xrm-front_static-const-arrays-desugar.xrm.test
EXTRA_DIST = *.xrm
--
SIGOURE Benoit aka Tsuna (SUSv3 compliant)
_____ "On a long enough timeline, the survival rate
/EPITA\ Promo 2008.CSI/ACU for everyone drops to zero" -- Jack.