Skip to content

Commit

Permalink
brushing up scripts, adding a new one to show a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed May 31, 2012
1 parent f9cdc37 commit 87b907a
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 275 deletions.
494 changes: 234 additions & 260 deletions shared/xsl/xbgf2xbnf.xslt

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions topics/transformation/update/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all:
make build
make test
make test1

check:
ls -1 tests/*/*.xbgf | xargs -n1 ../../../shared/tools/validate xbgf
Expand All @@ -14,15 +14,15 @@ build:
cp ../../convergence/xbgf/fl/snapshot/rascal.bgf tests/input/g1.bgf
cp ../../convergence/xbgf/fl/snapshot/rascal.bgf tests/incompatible/g1.bgf

test:
./testperform bad-f
./testperform bad-d
./testperform independent
./testperform input
./testperform incompatible
test1:
@./run1 bad-f || echo OUTCOME is ERROR
@./run1 bad-d || echo OUTCOME is ERROR
@./run1 independent || echo OUTCOME is ERROR
@./run1 input || echo OUTCOME is ERROR
@./run1 incompatible || echo OUTCOME is ERROR

quiet:
make test | grep OUTCOME
make test1 | grep OUTCOME

clean:
rm -f tests/*/g?.bgf tests/*/*.cbgf tests/*/d-1*.xbgf
rm -f tests/*/g?.bgf tests/*/*.cbgf tests/*/d-1*.xbgf tests/*/e.xbgf tests/*/g.xbgf
2 changes: 2 additions & 0 deletions topics/transformation/update/id.xbgf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<xbgf:sequence xmlns:bgf="http://planet-sl.org/bgf" xmlns:xbgf="http://planet-sl.org/xbgf"/>
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
#!/bin/sh

echo [Test Update] $1
# let's try f of G1
# let's try ƒ of G1
../../../shared/tools/xbgf tests/$1/f.xbgf tests/$1/g1.bgf tests/$1/g2.bgf
if [ $? -ne 0 ]
then
echo "OUTCOME for $1: Impossible output — bad f."
exit
exit -1
fi
# let's try ∆ of G1
../../../shared/tools/xbgf tests/$1/d.xbgf tests/$1/g1.bgf tests/$1/g3.bgf
if [ $? -ne 0 ]
then
echo "OUTCOME for $1: Impossible output — incompatible ∆."
exit
exit -1
fi
# let's try f of ∆ of G1 and ∆ of f of G1
# let's try ƒ of ∆ of G1 and ∆ of ƒ of G1
../../../shared/tools/xbgf tests/$1/f.xbgf tests/$1/g3.bgf tests/$1/g4.bgf && ../../../shared/tools/xbgf tests/$1/d.xbgf tests/$1/g2.bgf tests/$1/g5.bgf && gdt tests/$1/g4.bgf tests/$1/g5.bgf
if [ $? -eq 0 ]
then
echo "OUTCOME for $1: f and ∆ are independent; any composition is valid."
cp tests/$1/f.xbgf tests/$1/g.xbgf
cp tests/$1/d.xbgf tests/$1/e.xbgf
exit
fi
# let's try f ofof G1 and ∆ of f of G1
# let's try to reverseand try to obtain G2=ƒ(G1) from G3=∆(G1) as ƒ(∆r(∆(G1)))
../../../shared/tools/xbgf2cbgf tests/$1/d.xbgf tests/$1/d.cbgf tests/$1/g1.bgf
../../../shared/tools/cbgf2xbgf tests/$1/d.cbgf /dev/null tests/$1/d-1.xbgf
../../../shared/tools/appendxbgf tests/$1/d-1-f.xbgf tests/$1/d-1.xbgf tests/$1/f.xbgf
../../../shared/tools/xbgf tests/$1/d-1-f.xbgf tests/$1/g3.bgf tests/$1/g6.bgf && gdt tests/$1/g2.bgf tests/$1/g6.bgf
if [ $? -eq 0 ]
then
echo "OUTCOME for $1: ∆ messes with input of f; a composition with reversed ∆ is valid."
echo "OUTCOME for $1: ∆ messes with the input of f; a composition with reversed ∆ is valid (but not necessarily correct)."
cp tests/$1/d-1-f.xbgf tests/$1/g.xbgf
cp id.xbgf tests/$1/e.xbgf
exit
fi
echo "OUTCOME for $1: f and ∆ are incompatible."
exit -1
26 changes: 26 additions & 0 deletions topics/transformation/update/show1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

echo [Show Update] $1
/bin/echo -n "ƒ = "
../../../shared/tools/xbgf2xbnf tests/$1/f.xbgf
/bin/echo -n "∆ = "
../../../shared/tools/xbgf2xbnf tests/$1/d.xbgf

(./run1 $1 || echo OUTCOME is ERROR) | grep OUTCOME

/bin/echo -n "g = "
if [ ! -r tests/$1/g.xbgf ]
then
echo ""
else
../../../shared/tools/xbgf2xbnf tests/$1/g.xbgf
# perl -pi -w -e 's/;\n/ ∘ /g;' tmp.xbnf
# cat tmp.xbnf
fi
/bin/echo -n "Γ = "
if [ ! -r tests/$1/e.xbgf ]
then
echo ""
else
../../../shared/tools/xbgf2xbnf tests/$1/e.xbgf
fi
2 changes: 2 additions & 0 deletions topics/transformation/update/tests/bad-d/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.bgf
e.xbgf
g.xbgf
2 changes: 2 additions & 0 deletions topics/transformation/update/tests/bad-f/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.bgf
e.xbgf
g.xbgf
2 changes: 2 additions & 0 deletions topics/transformation/update/tests/incompatible/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.bgf
*.cbgf
d-1*.xbgf
e.xbgf
g.xbgf
2 changes: 2 additions & 0 deletions topics/transformation/update/tests/independent/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.bgf
e.xbgf
g.xbgf
2 changes: 2 additions & 0 deletions topics/transformation/update/tests/input/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.bgf
*.cbgf
d-1*.xbgf
e.xbgf
g.xbgf

0 comments on commit 87b907a

Please sign in to comment.