tamer: tests/xmli: Break apart single test case
This would have gotten unwieldy as time goes on, and already made looking at traces very difficult. DEV-13708main
parent
7ebd494752
commit
a261e75fe0
|
@ -27,3 +27,8 @@ Test are prefixed with `test-*` and are executable. They must be invoked
|
|||
with the environment variable `PATH_TAMEC` set to the path of `tamec`
|
||||
relative to the working directory.
|
||||
|
||||
Test cases are organized into sub-directories with `src.xml` and
|
||||
`expected.xml` files. `src.xml` will be compiled with `tamec`, its output
|
||||
formatted with `xmllint --format`, and `diff`'d against the
|
||||
`xmllint`-formatted output of `expected.xml`.
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<classify as="always" />
|
||||
|
||||
<classify as="sometimes">
|
||||
<any>
|
||||
<all />
|
||||
<any />
|
||||
<all />
|
||||
</any>
|
||||
<any />
|
||||
</classify>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<classify as="always" />
|
||||
|
||||
<classify as="sometimes">
|
||||
<any>
|
||||
<all />
|
||||
<any />
|
||||
<all />
|
||||
</any>
|
||||
<any />
|
||||
</classify>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<rate yields="preTpl" />
|
||||
|
||||
<template name="_empty_" />
|
||||
|
||||
<rate yields="postTpl" />
|
||||
</package>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
This mixes various entities together to ensure that the parser properly
|
||||
handles internal state changes.
|
||||
|
||||
<rate yields="preTpl" />
|
||||
|
||||
<template name="_empty_" />
|
||||
|
||||
<rate yields="postTpl" />
|
||||
</package>
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template"/>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
</package>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<rate yields="rateFoo" />
|
||||
|
||||
<rate yields="rateBar">
|
||||
<c:sum />
|
||||
<c:product />
|
||||
</rate>
|
||||
|
||||
<rate yields="rateBaz">
|
||||
<c:sum>
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:sum>
|
||||
<c:product>
|
||||
<c:sum />
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:product>
|
||||
</rate>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<rate yields="rateFoo" />
|
||||
|
||||
<rate yields="rateBar">
|
||||
<c:sum />
|
||||
<c:product />
|
||||
</rate>
|
||||
|
||||
<rate yields="rateBaz">
|
||||
<c:sum>
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:sum>
|
||||
<c:product>
|
||||
<c:sum />
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:product>
|
||||
</rate>
|
||||
</package>
|
||||
|
|
@ -1,45 +1,10 @@
|
|||
|
||||
<package xmlns="http://www.lovullo.com/rater"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<rate yields="rateFoo" />
|
||||
|
||||
<rate yields="rateBar">
|
||||
<c:sum />
|
||||
<c:product />
|
||||
</rate>
|
||||
|
||||
<rate yields="rateBaz">
|
||||
<c:sum>
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:sum>
|
||||
<c:product>
|
||||
<c:sum />
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:product>
|
||||
</rate>
|
||||
|
||||
<classify as="always" />
|
||||
|
||||
<classify as="sometimes">
|
||||
<any>
|
||||
<all />
|
||||
<any />
|
||||
<all />
|
||||
</any>
|
||||
<any />
|
||||
</classify>
|
||||
|
||||
<template name="_empty_" />
|
||||
|
||||
<rate yields="postTpl" />
|
||||
|
||||
<template name="_with-static-reachable_">
|
||||
|
||||
|
||||
|
@ -85,8 +50,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<rate yields="tplStaticMix" />
|
||||
|
||||
<c:sum>
|
||||
|
@ -94,3 +57,4 @@
|
|||
</c:sum>
|
||||
</template>
|
||||
</package>
|
||||
|
|
@ -3,43 +3,8 @@
|
|||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
This is the source package to be read by `tamec`.
|
||||
The output `out.xmli` is asserted against `expected.xml`.
|
||||
|
||||
<rate yields="rateFoo" />
|
||||
|
||||
<rate yields="rateBar">
|
||||
<c:sum />
|
||||
<c:product />
|
||||
</rate>
|
||||
|
||||
<rate yields="rateBaz">
|
||||
<c:sum>
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:sum>
|
||||
<c:product>
|
||||
<c:sum />
|
||||
<c:product />
|
||||
<c:sum />
|
||||
</c:product>
|
||||
</rate>
|
||||
|
||||
<classify as="always" />
|
||||
|
||||
<classify as="sometimes">
|
||||
<any>
|
||||
<all />
|
||||
<any />
|
||||
<all />
|
||||
</any>
|
||||
<any />
|
||||
</classify>
|
||||
|
||||
<template name="_empty_" />
|
||||
|
||||
<rate yields="postTpl" />
|
||||
|
||||
<template name="_with-static-reachable_">
|
||||
All expressions here are reachable
|
||||
(having been derived from named statements).
|
||||
|
@ -94,3 +59,4 @@
|
|||
</c:sum>
|
||||
</template>
|
||||
</package>
|
||||
|
|
@ -20,11 +20,13 @@ tamer-flag-or-exit-ok wip-asg-derived-xmli
|
|||
# that is intended._ We want to be well aware of such changes in derivation
|
||||
# so that we can judge whether it needs adjustment.
|
||||
test-derive-from-src() {
|
||||
echo '# test-derive-from-src'
|
||||
"${TAMER_PATH_TAMEC?}" -o "$mypath/out.xmli" --emit xmlo "$mypath/src.xml" || return
|
||||
local dir="${1?Missing directory name}"
|
||||
|
||||
diff <("$P_XMLLINT" --format "$mypath/expected.xml" || echo 'ERR expected.xml') \
|
||||
<("$P_XMLLINT" --format "$mypath/out.xmli" || echo 'ERR out.xmli')
|
||||
echo "# test-derive-from-src $dir"
|
||||
"${TAMER_PATH_TAMEC?}" -o "$dir/out.xmli" --emit xmlo "$dir/src.xml" || return
|
||||
|
||||
diff <("$P_XMLLINT" --format "$dir/expected.xml" || echo 'ERR expected.xml') \
|
||||
<("$P_XMLLINT" --format "$dir/out.xmli" || echo 'ERR out.xmli')
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,18 +40,22 @@ test-derive-from-src() {
|
|||
# Note that, in the future, we'll have to strip handoff metadata
|
||||
# (`preproc:*` data) from the output so that it will be accepted by TAMER.
|
||||
test-fixpoint() {
|
||||
echo '# test-fixpoint'
|
||||
"${TAMER_PATH_TAMEC?}" -o "$mypath/out-2.xmli" --emit xmlo "$mypath/out.xmli" || return
|
||||
local dir="${1?Missing directory name}"
|
||||
|
||||
diff <("$P_XMLLINT" --format "$mypath/expected.xml" || echo 'ERR expected.xml') \
|
||||
<("$P_XMLLINT" --format "$mypath/out-2.xmli" || echo 'ERR out.xmli')
|
||||
echo "# test-fixpoint $dir"
|
||||
"${TAMER_PATH_TAMEC?}" -o "$dir/out-2.xmli" --emit xmlo "$dir/out.xmli" || return
|
||||
|
||||
diff <("$P_XMLLINT" --format "$dir/expected.xml" || echo 'ERR expected.xml') \
|
||||
<("$P_XMLLINT" --format "$dir/out-2.xmli" || echo 'ERR out.xmli')
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
local fail=
|
||||
|
||||
test-derive-from-src && test-fixpoint || fail=1
|
||||
for dir in "$mypath"/*/; do
|
||||
test-derive-from-src "$dir" && test-fixpoint "$dir" || fail=1
|
||||
done
|
||||
|
||||
test -z "$fail" || {
|
||||
cat << EOF
|
||||
|
|
Loading…
Reference in New Issue