diff options
-rw-r--r-- | tests/runtests.pd | 22 | ||||
-rwxr-xr-x | tests/runtests.sh | 28 | ||||
-rw-r--r-- | tests/runtests.txt | 0 | ||||
-rw-r--r-- | tests/runtests_nogui.pd | 44 | ||||
-rw-r--r-- | tests/testunit.pd | 78 |
5 files changed, 172 insertions, 0 deletions
diff --git a/tests/runtests.pd b/tests/runtests.pd new file mode 100644 index 0000000..db72b4c --- /dev/null +++ b/tests/runtests.pd @@ -0,0 +1,22 @@ +#N canvas 367 200 813 499 10; +#X obj 177 433 testunit; +#X obj 177 377 textfile; +#X obj 177 183 t b b; +#X msg 207 261 read runtests.txt \, rewind; +#X obj 177 287 metro 10; +#X msg 243 289 0; +#X obj 177 126 bng 40 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 177 351 bang; +#X symbolatom 195 408 10 0 0 0 - - -; +#X obj 485 341 mtx_col/exist; +#X connect 1 0 0 0; +#X connect 1 1 5 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 3 0 1 0; +#X connect 4 0 7 0; +#X connect 5 0 4 0; +#X connect 6 0 2 0; +#X connect 7 0 1 0; +#X connect 8 0 0 0; diff --git a/tests/runtests.sh b/tests/runtests.sh new file mode 100755 index 0000000..51c54c9 --- /dev/null +++ b/tests/runtests.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +RUNTESTS_TXT=runtests.txt +RUNTESTS_LOG=runtests.log + +ls -1 */*.pd | sed 's/\.pd/;/' > ${RUNTESTS_TXT} + +LIBFLAGS="-lib ../zexy -path ../abs/" + +function run_nogui() { + pd ${LIBFLAGS} -nogui runtests_nogui.pd > ${RUNTESTS_LOG}.$$ 2>&1 + NUMTESTS=`grep -c . ${RUNTESTS_TXT}` + echo "regression-test: ${NUMTESTS} tests total" >> ${RUNTESTS_LOG}.$$ + + cat ${RUNTESTS_LOG}.$$ | egrep "^regression-test: " | sed -e 's/^regression-test: //' +} + +function run_withgui() { + pd ${LIBFLAGS} -stderr runtests.pd > ${RUNTESTS_LOG} 2>&1 +} + +if test "x$1" = "x-gui"; then + run_withgui +else + run_nogui +fi + + diff --git a/tests/runtests.txt b/tests/runtests.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/runtests.txt diff --git a/tests/runtests_nogui.pd b/tests/runtests_nogui.pd new file mode 100644 index 0000000..229874d --- /dev/null +++ b/tests/runtests_nogui.pd @@ -0,0 +1,44 @@ +#N canvas 209 168 427 557 10; +#X obj 86 209 testunit; +#X obj 86 130 textfile; +#X obj 86 56 t b b; +#X msg 116 84 read runtests.txt \, rewind; +#X obj 86 34 loadbang; +#X msg 137 171 \; pd quit; +#X obj 86 110 until; +#X obj 86 233 select 0 1; +#X obj 111 259 + 1; +#X obj 171 259 + 1; +#X obj 87 312 i; +#X obj 130 312 i; +#X obj 130 381 print regression-test; +#X msg 130 356 \$1 tests passed; +#X msg 87 335 \$1 tests failed; +#X obj 87 291 t b b; +#X obj 137 150 t b b; +#X obj 86 259 i 1; +#X obj 146 259 i 1; +#X connect 0 0 7 0; +#X connect 1 0 0 0; +#X connect 1 1 16 0; +#X connect 2 0 6 0; +#X connect 2 1 3 0; +#X connect 3 0 1 0; +#X connect 4 0 2 0; +#X connect 6 0 1 0; +#X connect 7 0 17 0; +#X connect 7 1 18 0; +#X connect 8 0 17 1; +#X connect 9 0 18 1; +#X connect 10 0 14 0; +#X connect 11 0 13 0; +#X connect 13 0 12 0; +#X connect 14 0 12 0; +#X connect 15 0 10 0; +#X connect 15 1 11 0; +#X connect 16 0 5 0; +#X connect 16 1 15 0; +#X connect 17 0 8 0; +#X connect 17 0 10 1; +#X connect 18 0 9 0; +#X connect 18 0 11 1; diff --git a/tests/testunit.pd b/tests/testunit.pd new file mode 100644 index 0000000..b5823fa --- /dev/null +++ b/tests/testunit.pd @@ -0,0 +1,78 @@ +#N canvas 695 274 312 252 10; +#N canvas 0 0 564 876 run-test 0; +#X obj 87 512 r \$0-receive; +#X obj 71 532 f; +#X msg 96 533 0; +#X obj 71 76 symbol; +#X obj 71 44 inlet test-to-run; +#X obj 71 639 outlet result; +#X obj 71 615 pack 0 s; +#X obj 181 205 makefilename pd-%d-regressiontest; +#X obj 109 226 pack s \$0 s; +#X obj 181 186 f \$0; +#X obj 109 160 t s b; +#X obj 143 489 t b s s; +#X obj 71 104 t b b s s; +#X msg 140 72 bang; +#X obj 90 135 s \$0-send; +#X msg 109 246 \; \$3 clear \; \$3 obj 100 100 r \$2-send \; \$3 obj +100 150 \$1 \; \$3 obj 100 200 s \$2-receive \; \$3 connect 0 0 1 0 +\; \$3 connect 1 0 2 0; +#N canvas 395 348 450 300 print 0; +#X obj 101 247 print regression-test; +#X obj 101 204 pack s s; +#X obj 101 117 select 1; +#X obj 152 137 b; +#X msg 152 160 failed; +#X msg 101 138 OK; +#X obj 101 185 symbol; +#X msg 101 223 \$2: \$1; +#X obj 296 82 inlet test; +#X obj 101 92 inlet result; +#X connect 1 0 7 0; +#X connect 2 0 5 0; +#X connect 2 1 3 0; +#X connect 3 0 4 0; +#X connect 4 0 6 0; +#X connect 5 0 6 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 8 0 1 1; +#X connect 9 0 2 0; +#X restore 101 584 pd print result; +#X obj 71 565 t f f; +#X msg 101 406 \; \$1 clear; +#X obj 101 386 symbol; +#X obj 71 364 t b b; +#X connect 0 0 1 1; +#X connect 1 0 17 0; +#X connect 2 0 1 1; +#X connect 3 0 12 0; +#X connect 4 0 3 0; +#X connect 6 0 5 0; +#X connect 7 0 8 2; +#X connect 7 0 19 1; +#X connect 8 0 15 0; +#X connect 9 0 7 0; +#X connect 10 0 8 0; +#X connect 10 1 9 0; +#X connect 11 0 2 0; +#X connect 11 1 6 1; +#X connect 11 2 16 1; +#X connect 12 0 20 0; +#X connect 12 1 14 0; +#X connect 12 2 10 0; +#X connect 12 3 11 0; +#X connect 13 0 3 0; +#X connect 17 0 6 0; +#X connect 17 1 16 0; +#X connect 19 0 18 0; +#X connect 20 0 1 0; +#X connect 20 1 19 0; +#X restore 94 138 pd run-test; +#X obj 94 163 outlet; +#X obj 94 111 inlet; +#N canvas 487 407 450 300 1005-regressiontest 0; +#X restore 92 186 pd \$0-regressiontest; +#X connect 0 0 1 0; +#X connect 2 0 0 0; |