From 092b32ed1d0dd5c8d267579e7f793330c6fce57e Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 6 Dec 2005 16:00:07 +0100 Subject: [PATCH] Test "PIP2" interface example. --- autoconf/Makefile.in | 1 + example/Makefile | 43 +++++++++++++++++++++++++++++++++++ example/big.ll | 16 +++++++++++++ example/brisebarre.ll | 41 +++++++++++++++++++++++++++++++++ example/cg1.ll | 26 +++++++++++++++++++++ example/esced.ll | 42 ++++++++++++++++++++++++++++++++++ example/ex.ll | 22 ++++++++++++++++++ example/ex2.ll | 22 ++++++++++++++++++ example/fimmel.ll | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ example/max.ll | 29 ++++++++++++++++++++++++ example/negative.ll | 14 ++++++++++++ example/small.ll | 16 +++++++++++++ example/sor1d.ll | 42 ++++++++++++++++++++++++++++++++++ example/square.ll | 16 +++++++++++++ example/sven.ll | 18 +++++++++++++++ 15 files changed, 411 insertions(+) create mode 100644 example/big.ll create mode 100644 example/brisebarre.ll create mode 100644 example/cg1.ll create mode 100644 example/esced.ll create mode 100644 example/ex.ll create mode 100644 example/ex2.ll create mode 100644 example/fimmel.ll create mode 100644 example/max.ll create mode 100644 example/negative.ll create mode 100644 example/small.ll create mode 100644 example/sor1d.ll create mode 100644 example/square.ll create mode 100644 example/sven.ll diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index e8a1695..aa4452b 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -243,6 +243,7 @@ install_piplibstatic: install_preparation check: $(MAKE) test -C test + $(MAKE) test -C example uninstall : @echo " /*-----------------------------------------------*" diff --git a/example/Makefile b/example/Makefile index 5b64a86..ebc6231 100644 --- a/example/Makefile +++ b/example/Makefile @@ -7,6 +7,25 @@ CC = gcc LDLIBS= -lpiplib32 CFLAGS= -DLINEAR_VALUE_IS_INT -I $(PIPLIB_INC) -L $(PIPLIB_LIB) +ROOT = .. + +PIPTEST = \ + big \ + brisebarre \ + cg1 \ + esced \ + ex \ + ex2 \ + fimmel \ + max \ + negative \ + small \ + sor1d \ + square \ + sven + +BITS = 64 + example: example.c @echo " /*-----------------------------------------------*" @echo " * Making example *" @@ -21,3 +40,27 @@ clean: @echo " * Cleaning example *" @echo " *-----------------------------------------------*/" -rm -f example example.exe core + +test: + failedtest=0; \ + for x in $(PIPTEST) ; do \ + echo "Verify file $$x" ; \ + $(ROOT)/obj$(BITS)_$(TARGET)/example$(BITS)$(EXEC_SUFFIX) < $$x.pip > xyz ;\ + diff -w xyz $$x.ll ; \ + result=$$?; \ + if [ "$$result" -eq "1" ]; then \ + echo "Error: $$x is not the same"; \ + failedtest=`expr $$failedtest + 1`; \ + else \ + echo "$$x passed"; \ + fi; \ + done ; \ + rm xyz ; \ + if [ $$failedtest != 0 ]; then \ + echo "$$failedtest tests failed"; \ + else \ + echo "PIP works correctly :-)"; \ + fi + +# Include the shared compilation rules +include $(ROOT)/Makefile diff --git a/example/big.ll b/example/big.ll new file mode 100644 index 0000000..2ca52a7 --- /dev/null +++ b/example/big.ll @@ -0,0 +1,16 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 3 +- the bignum column (start at 0, -1 if no bignum), +1 +- the constraint matrix. +4 5 + 1 -1 0 1 0 + 1 0 -1 1 0 + 1 -1 3 -2 12 + 1 2 -1 -1 3 + +(list + #[ 1 -4] + #[ 1 -5] +) diff --git a/example/brisebarre.ll b/example/brisebarre.ll new file mode 100644 index 0000000..ba4b503 --- /dev/null +++ b/example/brisebarre.ll @@ -0,0 +1,41 @@ +[PIP2-like future input] Please enter: +- the context matrix, +1 2 + 1 0 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +26 6 + 1 3 0 0 0 -98300 + 1 -3 0 0 0 98308 + 1 432 36 6 1 -14757611 + 1 -432 -36 -6 -1 14758510 + 1 54 9 3 1 -1923190 + 1 -54 -9 -3 -1 1923303 + 1 48 12 6 3 -1782238 + 1 -48 -12 -6 -3 1782339 + 1 27 9 6 4 -1045164 + 1 -27 -9 -6 -4 1045221 + 1 432 180 150 125 -17434139 + 1 -432 -180 -150 -125 17435038 + 1 6 3 3 3 -252443 + 1 -6 -3 -3 -3 252456 + 1 432 252 294 343 -18949275 + 1 -432 -252 -294 -343 18950174 + 1 27 18 24 32 -1234720 + 1 -27 -18 -24 -32 1234777 + 1 48 36 54 81 -2288453 + 1 -48 -36 -54 -81 2288554 + 1 54 45 75 125 -2684050 + 1 -54 -45 -75 -125 2684163 + 1 432 396 726 1331 -22386005 + 1 -432 -396 -726 -1331 22386904 + 1 3 3 6 12 -162072 + 1 -3 -3 -6 -12 162080 + +(list + #[ 32767] + #[ 16407] + #[ 1989] + #[ 218] +) diff --git a/example/cg1.ll b/example/cg1.ll new file mode 100644 index 0000000..faf2192 --- /dev/null +++ b/example/cg1.ll @@ -0,0 +1,26 @@ +[PIP2-like future input] Please enter: +- the context matrix, +2 4 + 1 1 0 -1 + 1 -1 1 0 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +8 7 + 1 0 1 0 -1 0 0 + 1 0 -1 0 1 0 0 + 1 1 0 0 0 -1 0 + 1 -1 0 0 0 1 0 + 1 0 1 0 0 0 -1 + 1 0 -1 0 0 1 0 + 1 0 -1 1 0 0 -1 + 1 0 0 -1 0 1 0 + +(if #[ -1 1 -1] + (list + #[ 0 1 0] + #[ 1 0 0] + #[ 1 0 1] + ) + () +) diff --git a/example/esced.ll b/example/esced.ll new file mode 100644 index 0000000..30f79f1 --- /dev/null +++ b/example/esced.ll @@ -0,0 +1,42 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 2 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +16 18 + 1 0 0 0 0 0 0 0 0 -1 0 0 1 0 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 -1 0 0 1 0 0 0 0 + 1 0 0 0 0 0 0 0 0 0 0 -1 0 0 1 0 0 0 + 1 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 + 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 + 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 + 0 0 0 0 -1 0 0 0 0 1 -1 0 0 0 0 0 0 0 + 0 0 0 0 0 -1 0 0 0 0 0 1 0 0 0 0 0 0 + 0 -1 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 + 0 0 0 0 0 0 -1 0 0 0 0 0 1 -1 0 -1 0 0 + 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 1 0 0 0 + 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 1 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 + 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 + 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 + 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 + +(list + #[ 1] + #[ 0] + #[ 1] + #[ 0] + #[ 0] + #[ 0] + #[ 1] + #[ 0] + #[ 1] + #[ 1] + #[ 0] + #[ 1] + #[ 1] + #[ 1] + #[ 0] + #[ 0] +) diff --git a/example/ex.ll b/example/ex.ll new file mode 100644 index 0000000..b6d5e1d --- /dev/null +++ b/example/ex.ll @@ -0,0 +1,22 @@ +[PIP2-like future input] Please enter: +- the context matrix, +1 5 + 1 -1 1 1 0 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +3 7 + 1 0 -1 0 1 0 0 + 1 -1 0 0 0 1 0 + 1 1 1 -1 0 0 0 + +(if #[ -1 1 0 0] + (list + #[ 0 0 0 0] + #[ 1 0 0 0] + ) + (list + #[ 1 -1 0 0] + #[ 0 1 0 0] + ) +) diff --git a/example/ex2.ll b/example/ex2.ll new file mode 100644 index 0000000..b6d5e1d --- /dev/null +++ b/example/ex2.ll @@ -0,0 +1,22 @@ +[PIP2-like future input] Please enter: +- the context matrix, +1 5 + 1 -1 1 1 0 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +3 7 + 1 0 -1 0 1 0 0 + 1 -1 0 0 0 1 0 + 1 1 1 -1 0 0 0 + +(if #[ -1 1 0 0] + (list + #[ 0 0 0 0] + #[ 1 0 0 0] + ) + (list + #[ 1 -1 0 0] + #[ 0 1 0 0] + ) +) diff --git a/example/fimmel.ll b/example/fimmel.ll new file mode 100644 index 0000000..dc2b6b6 --- /dev/null +++ b/example/fimmel.ll @@ -0,0 +1,63 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 4 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +7 6 + 1 2 6 0 0 -9 + 1 5 -3 0 0 0 + 1 2 -10 0 0 15 + 1 -2 6 0 0 -3 + 1 -2 -6 0 0 17 + 1 0 1 -1 0 0 + 1 1 0 0 -1 0 + +(if #[ 0 -4 3] + (if #[ -4 0 5] + () + (if #[ -1 0 3] + (if #[ -1 0 2] + () + () + ) + () + ) + ) + (if #[ 0 -2 9] + (if #[ -6 -2 9] + (if #[ 0 -2 3] + (newparm 2 (div #[ 0 2 3] 6)) + (newparm 3 (div #[ 0 2 10 7] 12)) + (newparm 4 (div #[ 0 4 0 2 1] 6)) + () + (if #[ 0 -2 7] + (newparm 2 (div #[ 0 4 3] 6)) + (if #[ 0 -8 6 11] + () + () + ) + () + ) + ) + (if #[ -6 -2 17] + (if #[ -3 5 0] + (if #[ 6 -2 -3] + () + (if #[ 0 -2 7] + (newparm 2 (div #[ 0 4 3] 6)) + (if #[ 0 -8 6 11] + () + () + ) + () + ) + ) + () + ) + () + ) + ) + () + ) +) diff --git a/example/max.ll b/example/max.ll new file mode 100644 index 0000000..6ece102 --- /dev/null +++ b/example/max.ll @@ -0,0 +1,29 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 3 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +4 5 + 1 -1 0 1 0 + 1 0 -1 1 0 + 1 -1 3 -2 12 + 1 2 -1 -1 3 + +(if #[ -1 3] + (list + #[ 0 0] + #[ 0 0] + ) + (if #[ -5 27] + (newparm 1 (div #[ 1 1] 2)) + (list + #[ 1 -1 -1] + #[ 0 0 0] + ) + (list + #[ 1 -4] + #[ 1 -5] + ) + ) +) diff --git a/example/negative.ll b/example/negative.ll new file mode 100644 index 0000000..102fce4 --- /dev/null +++ b/example/negative.ll @@ -0,0 +1,14 @@ +[PIP2-like future input] Please enter: +- the context matrix, +1 3 + 1 1 -1 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +2 4 + 1 1 0 1 + 1 -1 1 0 + +(list + #[ 0 0] +) diff --git a/example/small.ll b/example/small.ll new file mode 100644 index 0000000..44560f2 --- /dev/null +++ b/example/small.ll @@ -0,0 +1,16 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 2 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +4 4 + 1 1 0 0 + 1 0 1 0 + 1 1 -3 12 + 1 -2 1 3 + +(list + #[ 0] + #[ 0] +) diff --git a/example/sor1d.ll b/example/sor1d.ll new file mode 100644 index 0000000..bd2b239 --- /dev/null +++ b/example/sor1d.ll @@ -0,0 +1,42 @@ +[PIP2-like future input] Please enter: +- the context matrix, +2 4 + 1 1 0 0 + 1 0 1 0 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +20 8 + 0 -1 0 0 0 0 0 2 + 0 0 -1 0 0 0 0 1 + 0 0 0 -1 0 0 0 2 + 0 0 0 0 -1 0 0 4 + 1 0 0 0 1 0 0 -2 + 1 -2 0 2 1 0 0 -4 + 1 0 0 0 -1 0 1 -1 + 1 2 0 -2 -1 0 0 5 + 1 0 0 1 0 0 0 -1 + 1 0 -2 1 0 0 0 0 + 1 -2 0 2 0 0 1 -5 + 1 0 0 -1 0 1 0 0 + 1 0 2 -1 0 0 0 1 + 1 2 0 -2 0 0 0 3 + 1 0 1 0 0 0 0 0 + 1 -2 4 0 0 0 1 -3 + 1 0 -2 0 0 1 0 0 + 1 2 -4 0 0 0 0 3 + 1 2 0 0 0 0 0 1 + 1 -2 0 0 0 2 1 -5 + +(if #[ 0 1 -5] + (if #[ 1 0 -2] + (list + #[ 0 0 2] + #[ 0 0 1] + #[ 0 0 2] + #[ 0 0 4] + ) + () + ) + () +) diff --git a/example/square.ll b/example/square.ll new file mode 100644 index 0000000..4d06819 --- /dev/null +++ b/example/square.ll @@ -0,0 +1,16 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 3 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +4 5 + 1 1 0 0 0 + 1 -1 0 1 0 + 1 0 1 0 0 + 1 0 -1 1 0 + +(list + #[ 0 0] + #[ 0 0] +) diff --git a/example/sven.ll b/example/sven.ll new file mode 100644 index 0000000..14fd21e --- /dev/null +++ b/example/sven.ll @@ -0,0 +1,18 @@ +[PIP2-like future input] Please enter: +- the context matrix, +0 3 +- the bignum column (start at 0, -1 if no bignum), +-1 +- the constraint matrix. +2 3 + 1 1 -4 + 1 -1 10 + +(if #[ 1 -4] + (if #[ -1 10] + (list + ) + () + ) + () +) -- 2.11.4.GIT