Author: jameson Date: 2006-02-27 03:12:39 +0100 (Mon, 27 Feb 2006) New Revision: 1566
Added: freesci/trunk/tests/ freesci/trunk/tests/parser/ freesci/trunk/tests/parser/config freesci/trunk/tests/parser/data/ freesci/trunk/tests/parser/data/diff.sh freesci/trunk/tests/parser/data/dosbox.sh freesci/trunk/tests/parser/data/fsci/ freesci/trunk/tests/parser/data/generated/ freesci/trunk/tests/parser/data/globals freesci/trunk/tests/parser/data/parsetest.s freesci/trunk/tests/parser/data/parsetest.s.body freesci/trunk/tests/parser/data/parsetest.s.head freesci/trunk/tests/parser/data/run-fsci.sh freesci/trunk/tests/parser/data/run-ssci.sh freesci/trunk/tests/parser/data/run-test.sh freesci/trunk/tests/parser/data/shuffle.sml freesci/trunk/tests/parser/data/ssci/ freesci/trunk/tests/parser/data/stats/ freesci/trunk/tests/parser/data/tmp/ freesci/trunk/tests/parser/run-all.sh freesci/trunk/tests/parser/test-specs Modified: freesci/trunk/ChangeLog freesci/trunk/config.log freesci/trunk/src/engine/kstring.c Log: * Added a few tests for the parser Very interesting results. Note that this has a few odd requirements (dosbox, scis) to work properly. I'll make an updated scis available shortly, at http://www-plan.cs.colorado.edu/creichen/freesci/scis. -- Christoph Modified: freesci/trunk/ChangeLog =================================================================== --- freesci/trunk/ChangeLog 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/ChangeLog 2006-02-27 02:12:39 UTC (rev 1566) @@ -1,3 +1,7 @@ +2006-02-27 Christoph Reichenbach <[EMAIL PROTECTED]> + + * tests/parser/test-specs: Added initial parser test suite + 2006-02-25 Alex Angas <[EMAIL PROTECTED]> * src/win32/msvc8-2005: New folder. Modified: freesci/trunk/config.log =================================================================== --- freesci/trunk/config.log 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/config.log 2006-02-27 02:12:39 UTC (rev 1566) @@ -4,7 +4,7 @@ It was created by configure, which was generated by GNU Autoconf 2.59. Invocation command line was - $ ./configure + $ ./configure --no-create --no-recursion ## --------- ## ## Platform. ## @@ -68,8 +68,8 @@ configure:1796: result: gcc configure:2040: checking for C compiler version configure:2043: gcc --version </dev/null >&5 -gcc (GCC) 4.0.3 20060115 (prerelease) (Debian 4.0.2-7) -Copyright (C) 2005 Free Software Foundation, Inc. +gcc (GCC) 4.0.3 20060212 (prerelease) (Debian 4.0.2-9) +Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -79,7 +79,7 @@ Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix -gcc version 4.0.3 20060115 (prerelease) (Debian 4.0.2-7) +gcc version 4.0.3 20060212 (prerelease) (Debian 4.0.2-9) configure:2051: $? = 0 configure:2053: gcc -V </dev/null >&5 gcc: '-V' option must have argument @@ -503,8 +503,8 @@ configure:6256: result: yes configure:6169: checking for memf configure:6226: gcc -o conftest -g -O2 conftest.c >&5 -/tmp/ccww7HS0.o: In function `main':/tmp/trunk/conftest.c:80: undefined reference to `memf' -/tmp/ccww7HS0.o:(.data+0x0): undefined reference to `memf' +/tmp/ccacx8lA.o: In function `main':/home/creichen/work/port/freesci/conftest.c:80: undefined reference to `memf' +/tmp/ccacx8lA.o:(.data+0x0): undefined reference to `memf' collect2: ld returned 1 exit status configure:6232: $? = 1 configure: failed program was: @@ -595,8 +595,8 @@ configure:6256: result: no configure:6169: checking for rob configure:6226: gcc -o conftest -g -O2 conftest.c >&5 -/tmp/ccIW9Zya.o: In function `main':/tmp/trunk/conftest.c:80: undefined reference to `rob' -/tmp/ccIW9Zya.o:(.data+0x0): undefined reference to `rob' +/tmp/ccADsoeL.o: In function `main':/home/creichen/work/port/freesci/conftest.c:80: undefined reference to `rob' +/tmp/ccADsoeL.o:(.data+0x0): undefined reference to `rob' collect2: ld returned 1 exit status configure:6232: $? = 1 configure: failed program was: @@ -779,7 +779,7 @@ configure:6764: gcc -E conftest.c configure:6770: $? = 0 configure:6829: gcc -o conftest -g -O2 -lgii -lgg conftest.c -lasound -lasound -lm >&5 -/tmp/cc0mu0Ch.o: In function `main':/tmp/trunk/conftest.c:54: undefined reference to `ggiInit' +/tmp/ccKsvySU.o: In function `main':/home/creichen/work/port/freesci/conftest.c:54: undefined reference to `ggiInit' collect2: ld returned 1 exit status configure:6835: $? = 1 configure: failed program was: @@ -2106,7 +2106,7 @@ configure:8179: gcc -E conftest.c configure:8185: $? = 0 configure:8245: gcc -o conftest -g -O2 conftest.c -lasound -lasound -lm >&5 -/tmp/ccQ0EMY6.o: In function `main':/tmp/trunk/conftest.c:56: undefined reference to `noecho' +/tmp/cci0Ju0W.o: In function `main':/home/creichen/work/port/freesci/conftest.c:56: undefined reference to `noecho' collect2: ld returned 1 exit status configure:8251: $? = 1 configure: failed program was: @@ -2276,7 +2276,7 @@ configure:10223: result: yes configure:10236: checking for XftDisplayInfoGet in -lXft configure:10266: gcc -o conftest -g -O2 -I/usr/include/freetype2 conftest.c -lXft -lasound -lasound -lm >&5 -/tmp/ccUADlRd.o: In function `main':/tmp/trunk/conftest.c:68: undefined reference to `XftDisplayInfoGet' +/tmp/ccuLraQd.o: In function `main':/home/creichen/work/port/freesci/conftest.c:68: undefined reference to `XftDisplayInfoGet' collect2: ld returned 1 exit status configure:10272: $? = 1 configure: failed program was: @@ -2679,49 +2679,6 @@ configure:11762: result: yes configure:11899: creating ./config.status -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by config.status, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status - -on maya - -config.status:789: creating Makefile -config.status:789: creating debian/Makefile -config.status:789: creating desktop/Makefile -config.status:789: creating doc/Makefile -config.status:789: creating doc/misc/Makefile -config.status:789: creating doc/man/Makefile -config.status:789: creating conf/Makefile -config.status:789: creating custom/Makefile -config.status:789: creating src/Makefile -config.status:789: creating src/scicore/Makefile -config.status:789: creating src/engine/Makefile -config.status:789: creating src/gfx/Makefile -config.status:789: creating src/gfx/drivers/Makefile -config.status:789: creating src/gfx/resource/Makefile -config.status:789: creating src/include/Makefile -config.status:789: creating src/include/win32/Makefile -config.status:789: creating src/include/beos/Makefile -config.status:789: creating src/tools/Makefile -config.status:789: creating src/win32/Makefile -config.status:789: creating src/sound/Makefile -config.status:789: creating src/morphos/Makefile -config.status:789: creating src/wince/Makefile -config.status:789: creating src/menu/Makefile -config.status:789: creating freesci.spec -config.status:855: creating config.h -config.status:1057: config.h is unchanged -config.status:1215: executing default-1 commands - ## ---------------- ## ## Cache variables. ## ## ---------------- ## @@ -3006,3 +2963,436 @@ #define YYTEXT_POINTER 1 configure: exit 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = config.h + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:855: creating config.h +config.status:1057: config.h is unchanged +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = doc/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating doc/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = doc/misc/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating doc/misc/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = doc/man/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating doc/man/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = desktop/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating desktop/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/scicore/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/scicore/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/engine/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/engine/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/include/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/include/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/include/win32/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/include/win32/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/include/beos/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/include/beos/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/gfx/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/gfx/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/gfx/resource/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/gfx/resource/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/gfx/drivers/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/gfx/drivers/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/sound/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/sound/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/tools/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/tools/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/win32/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/win32/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/morphos/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/morphos/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/wince/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/wince/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = src/menu/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating src/menu/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = conf/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating conf/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = debian/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating debian/Makefile +config.status:1215: executing default-1 commands + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = custom/Makefile + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on maya + +config.status:789: creating custom/Makefile +config.status:1215: executing default-1 commands Modified: freesci/trunk/src/engine/kstring.c =================================================================== --- freesci/trunk/src/engine/kstring.c 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/src/engine/kstring.c 2006-02-27 02:12:39 UTC (rev 1566) @@ -135,7 +135,9 @@ vocab_decypher_said_block(s, said_block); } - if (!(s->parser_event) || (GET_SELECTOR(s->parser_event, claimed))) { + if (!(s->parser_event) + || (GET_SELECTOR(s->parser_event, claimed)) + || ((GET_SELECTOR(s->parser_event, type) & 0x80) == 0)) { s->acc = 0; return; } Added: freesci/trunk/tests/parser/config =================================================================== --- freesci/trunk/tests/parser/config 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/config 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,19 @@ +# Some binaries: +## Dosbox +DOSBOX_BIN="dosbox -conf ${HOME}/.dosbox" + +## SML of New Jersey +SMLNJ=sml + +## SCI Assembler +SCIS="${HOME}/work/port/scis/scis" + + +# A game to test with: +TEST_GAME_DIR="${HOME}/work/port/sci/dumb" + +# This is where FreeSCI stores its temp result files: +FSCI_DATA_DIR="${HOME}/.freesci/said" + +#VERBOSE=1 + Added: freesci/trunk/tests/parser/data/diff.sh =================================================================== --- freesci/trunk/tests/parser/data/diff.sh 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/diff.sh 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,83 @@ +#! /bin/bash + +NR=$1 + +. globals + +FALSE_POSITIVE=${STATS_DIR}/false-positive.${NR} +FALSE_NEGATIVE=${STATS_DIR}/false-negative.${NR} +INDEX_FILE=${GEN_DIR}/index.${NR} +SPEC_FILE=${GEN_DIR}/spec.${NR} +DEST_FILE=PARSE.${NR} +COUNT_FILE=${STATS_DIR}/count.${NR} + +SSCI_FILE=${SSCI_RESULT}/${DEST_FILE} +FSCI_FILE=${FSCI_RESULT}/${DEST_FILE} + +TESTCASE=`cat ${SPEC_FILE}` || (echo "Invalid testcase number"; exit 1) + +if [ x${NR} = x ]; then + echo "Usage: $0 <nr>" + exit 1 +fi + +rm -f ${FALSE_POSITIVE} +touch ${FALSE_POSITIVE} +rm -f ${FALSE_NEGATIVE} +touch ${FALSE_NEGATIVE} + +TAB_SSCI=${TMP_DIR}/ssci.tab +TAB_FSCI=${TMP_DIR}/fsci.tab + +cat ${SSCI_FILE} | sed 's/\(.\)/\1\n/g' | awk '{printf "%d\t%d\n", (n++), $1}' > ${TAB_SSCI} +cat ${FSCI_FILE} | sed 's/\(.\)/\1\n/g' | awk '{printf "%d\t%d\n", (n++), $1}' > ${TAB_FSCI} + +TAB_JOIN=${TMP_DIR}/joined.tab +TAB_ALL=${TMP_DIR}/all.tab +MARKED_INDEX=${TMP_DIR}/marked-index.tab + +cat ${INDEX_FILE} | tr ' ' '*' > ${MARKED_INDEX} +join ${TAB_SSCI} ${TAB_FSCI} > ${TAB_JOIN} +join ${TAB_JOIN} ${MARKED_INDEX} > ${TAB_ALL} + +COUNT=0 +FP_COUNT=0 +FN_COUNT=0 + +for n in `cat ${TAB_ALL} | tr ' ' '_'`; do + arr=(`echo $n | tr '_' ' '`) + idx=${arr[0]} + ssci=${arr[1]} + fsci=${arr[2]} + text=`echo ${arr[3]} | tr '*' ' '` + + COUNT=$(( COUNT + 1 )) + + if [ $ssci == 0 ]; then + if [ $fsci == 1 ]; then + FP_COUNT=$(( FP_COUNT + 1 )) + echo $text >> ${FALSE_POSITIVE} + fi + else + if [ $fsci == 0 ]; then + FN_COUNT=$(( FN_COUNT + 1 )) + echo $text >> ${FALSE_NEGATIVE} + fi + fi +done + +if [ $((FP_COUNT + FN_COUNT)) != 0 ]; then + echo " * Spec '${TESTCASE}' has $((FP_COUNT + FN_COUNT)) error(s):" + + if [ ${FP_COUNT} != 0 ]; then + echo " - ${FP_COUNT} incorrect matches:" + cat ${FALSE_POSITIVE} | awk '{print "\t\t" $0}' + fi + + if [ ${FN_COUNT} != 0 ]; then + echo " - ${FN_COUNT} missed matches:" + cat ${FALSE_NEGATIVE} | awk '{print "\t\t" $0}' + fi +fi + +echo ${COUNT} > ${COUNT_FILE} Property changes on: freesci/trunk/tests/parser/data/diff.sh ___________________________________________________________________ Name: svn:executable + * Added: freesci/trunk/tests/parser/data/dosbox.sh =================================================================== --- freesci/trunk/tests/parser/data/dosbox.sh 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/dosbox.sh 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,9 @@ +#! /bin/bash + +. globals + + +${DOSBOX_BIN} -exit dir -c "mount s ${TEST_GAME_DIR} +s: +sciv.exe +exit" Property changes on: freesci/trunk/tests/parser/data/dosbox.sh ___________________________________________________________________ Name: svn:executable + * Added: freesci/trunk/tests/parser/data/globals =================================================================== --- freesci/trunk/tests/parser/data/globals 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/globals 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,21 @@ +# Global definitions + +# Import configuration: +. ../config + + +# Directories +GEN_DIR=generated +TMP_DIR=tmp +STATS_DIR=stats + + +# FSCI definitions +FSCI_BIN="../../../src/freesci -Pnull -gnull -d "${TEST_GAME_DIR}"" +FSCI_RESULT=fsci + +# SSCI definitions +SSCI_BIN=./dosbox.sh +SSCI_RESULT=ssci + + Added: freesci/trunk/tests/parser/data/parsetest.s =================================================================== --- freesci/trunk/tests/parser/data/parsetest.s 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/parsetest.s 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,135 @@ +.exports + &MAINOBJ + +.locals +FD: $0000 +OUT: $0000 + + +.code + +;-------------------------------------------------- +; PRINTFN: Prints accumulator to FD +;-------------------------------------------------- +PRINTFN: + link $0000 + push + pushi 48 + add + sal 1 + pushi 2 + lsl 0 + pushi &OUT + callk $2a $4 + ret + +;-------------------------------------------------- +; TESTSTRING: Try string in acc +;-------------------------------------------------- +TESTSAID: + pushi 2 + push + pushi &EVENTOBJ + callk $24 $4 ; Parse + pushi 1 + pushi &SPEC0 + callk $25 $2 ; Said + + pushi 0 + call &PRINTFN 0 + ret + + +;-------------------------------------------------- +; MAINFN: Main entry point +;-------------------------------------------------- +MAINFN: SelfID + + ;; File initialisation + pushi 2 + pushi &FILENAME + pushi 2 ; Create anew + callk $29 $4 ; FOpen + sal 0 ; fd + +;; pushi 0 +;; callk $57 $0 ; Debug + ;; Begin main functionality + + ldi &PARSESTRING0 + pushi 0 + call &TESTSAID 0 + + ;; Deinitialisation: Close output file + pushi 1 + lsl 0 ; fd + callk $2c $2 ; FClose + ret ; Quit + +.class + $1234 + $0000 ; Locals + 18 ; Functarea + 4 ; # of varselcs +MAINOBJ: + ;; Varselectors + 0 + 0 + $8000 + &NAME + + $0 ; species + $1 ; superclass + $2 ; -info- + $17 ; Name + + ;; Funcselectors + + 1 ; One overridden + $2a ; play + 0 ; dummy + &MAINFN + +.object + $1234 + $0000 ; Locals + 20 ; Functarea + 10 ; # of varselcs +EVENTOBJ: +; $0; species[0000] = 3398 %Event +; $1;superClass[0001] = 2ccc %Obj +; $2; -info-[0002] = 8000 +; $17; name[0017] = 33fa +; $22; type[0022] = 0000 (0) +; $28; message[0028] = 0000 (0) +; $40; modifiers[0040] = 0000 (0) +; $3; y[0003] = 0000 (0) +; $4; x[0004] = 0000 (0) +; $4c; claimed[004c] = 0000 (0) + + ;; Varselectors + 7 ; + 7 ; Event + $0000 + &EVENTNAME + $80 ; type + 0 ; message + 0 ; modifiers + 0 ; x + 0 ; y + 0 ; claimed + + ;; Funcselectors + + 0 ; Zero overridden + 0 ; dummy + +.strings +NAME: "said" +EVENTNAME: "simple-event" +PARSESTRING0: "shine" +FILENAME: "PARSE.000" + +.said +;SPEC0: $48b < $142 / $93c ! +SPEC0: $48b ! ! Added: freesci/trunk/tests/parser/data/parsetest.s.body =================================================================== --- freesci/trunk/tests/parser/data/parsetest.s.body 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/parsetest.s.body 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,73 @@ + ;; Deinitialisation: Close output file + pushi 1 + lsl 0 ; fd + callk $2c $2 ; FClose + ret ; Quit + +.class + $1234 + $0000 ; Locals + 18 ; Functarea + 4 ; # of varselcs +MAINOBJ: + ;; Varselectors + 0 + 0 + $8000 + &NAME + + $0 ; species + $1 ; superclass + $2 ; -info- + $17 ; Name + + ;; Funcselectors + + 1 ; One overridden + $2a ; play + 0 ; dummy + &MAINFN + +.object + $1234 + $0000 ; Locals + 20 ; Functarea + 10 ; # of varselcs +EVENTOBJ: +; $0; species[0000] = 3398 %Event +; $1;superClass[0001] = 2ccc %Obj +; $2; -info-[0002] = 8000 +; $17; name[0017] = 33fa +; $22; type[0022] = 0000 (0) +; $28; message[0028] = 0000 (0) +; $40; modifiers[0040] = 0000 (0) +; $3; y[0003] = 0000 (0) +; $4; x[0004] = 0000 (0) +; $4c; claimed[004c] = 0000 (0) + + ;; Varselectors + 7 ; + 7 ; Event + $0000 + &EVENTNAME + $80 ; type + 0 ; message + 0 ; modifiers + 0 ; x + 0 ; y + 0 ; claimed + + ;; Funcselectors + + 0 ; Zero overridden + 0 ; dummy + +.strings +NAME: "said" +EVENTNAME: "simple-event" +;; PARSESTRING0: "shine" +;; FILENAME: "PARSE.000" + +;; .said +;; SPEC0: $48b < $142 / $93c ! +;; SPEC0: $48b ! ! Added: freesci/trunk/tests/parser/data/parsetest.s.head =================================================================== --- freesci/trunk/tests/parser/data/parsetest.s.head 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/parsetest.s.head 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,58 @@ +.exports + &MAINOBJ + +.locals +FD: $0000 +OUT: $0000 + + +.code + +;-------------------------------------------------- +; PRINTFN: Prints accumulator to FD +;-------------------------------------------------- +PRINTFN: + link $0000 + push + pushi 48 + add + sal 1 + pushi 2 + lsl 0 + pushi &OUT + callk $2a $4 + ret + +;-------------------------------------------------- +; TESTSTRING: Try string in acc +;-------------------------------------------------- +TESTSAID: + pushi 2 + push + pushi &EVENTOBJ + callk $24 $4 ; Parse + pushi 1 + pushi &SPEC0 + callk $25 $2 ; Said + + pushi 0 + call &PRINTFN 0 + ret + + +;-------------------------------------------------- +; MAINFN: Main entry point +;-------------------------------------------------- +MAINFN: SelfID + + ;; File initialisation + pushi 2 + pushi &FILENAME + pushi 2 ; Create anew + callk $29 $4 ; FOpen + sal 0 ; fd + +;; pushi 0 +;; callk $57 $0 ; Debug + ;; Begin main functionality + Added: freesci/trunk/tests/parser/data/run-fsci.sh =================================================================== --- freesci/trunk/tests/parser/data/run-fsci.sh 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/run-fsci.sh 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,15 @@ +#! /bin/bash + +#TEST_GAME_DIR="/home/creichen/work/port/sci/dumb" +#FSCI_DATA_DIR="/home/creichen/.freesci/said" + +. globals + + +if [ x$2 = x ]; then + echo "Usage: $0 <test-spec> <nr>" + echo " e.g. $0 \"shine-48b < up-142 / light-93c\" 000" + exit 1 +fi + +./run-test.sh "$1" "$2" "${TEST_GAME_DIR}" "${FSCI_DATA_DIR}" "${FSCI_BIN}" "${FSCI_RESULT}" Property changes on: freesci/trunk/tests/parser/data/run-fsci.sh ___________________________________________________________________ Name: svn:executable + * Added: freesci/trunk/tests/parser/data/run-ssci.sh =================================================================== --- freesci/trunk/tests/parser/data/run-ssci.sh 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/run-ssci.sh 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,13 @@ +#! /bin/bash + +. globals + +SSCI_RESULT=ssci + +if [ x$2 = x ]; then + echo "Usage: $0 <test-spec> <nr>" + echo " e.g. $0 \"shine-48b < up-142 / light-93c\" 000" + exit 1 +fi + +./run-test.sh "$1" "$2" "${TEST_GAME_DIR}" "${TEST_GAME_DIR}" "${SSCI_BIN}" "${SSCI_RESULT}" Property changes on: freesci/trunk/tests/parser/data/run-ssci.sh ___________________________________________________________________ Name: svn:executable + * Added: freesci/trunk/tests/parser/data/run-test.sh =================================================================== --- freesci/trunk/tests/parser/data/run-test.sh 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/run-test.sh 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,70 @@ +#! /bin/bash +# Runs a single test and saves the result files. + +#Binaries: + +. globals + +TESTCASE=$1 +NR=$2 +DEST_DIR=$3 +SCI_WORK_DIR=$4 +RUNNER=$5 +OUTPUT_DIR=$6 + + +ASM_HEAD=parsetest.s.head +ASM_BODY=parsetest.s.body +SHUFFLE_SRC=shuffle.sml + + +# Temp and aux files +ASM_FILE=${GEN_DIR}/test.${NR}.s +INDEX_FILE=${GEN_DIR}/index.${NR} +SPEC_FILE=${GEN_DIR}/spec.${NR} +SHUFFLE_FILE=${TMP_DIR}/shuffle.${NR}.sml +DEST_FILE=PARSE.${NR} + + +echo ${TESTCASE} > ${SPEC_FILE} + +if [ x${OUTPUT_DIR} = x ]; then + echo "Usage: $n0 <testcase-spec> <nr> <dest-dir> <sci-work-dir> <runner> <ssci|fsci>" + echo " testcase-spec: E.g. \"look-474 / room-804\"" + echo " nr: PARSE.<nr> will be produced" + echo " dest-dir: Installation directory of SCI resource files" + echo " sci-work-dir: Directory into which the SCI interpreter will put its result files" + echo " runner: Program to invoke for generating the result file" + exit 1; +fi + +SPEC=`echo ${TESTCASE} | sed 's/\b[^- ]*-/\$/g'` +SPEC="${SPEC} !" + +WORDS=`echo ${TESTCASE} | sed 's/\b\([^- ]*\)-[^\B ]*/\1/g' | tr '<>()[]/,&#' ' ' | tr ' ' '\n' | awk '{if ($0) print}'` + +( + echo "val (_::words) = [ \"\"" + for w in ${WORDS}; do echo " ,\"${w}\" "; done + echo "];" + cat ${SHUFFLE_SRC} +) > ${SHUFFLE_FILE} + +${SMLNJ} ${SHUFFLE_FILE} | awk '/@@START/ {ok=1} /@@END/ {ok=0} {if (ok > 2) {print (nr++) "\t" $0}; if (ok) ok++}' > ${INDEX_FILE} + +( + cat ${ASM_HEAD}; + cat ${INDEX_FILE} | awk '{ print "\n\n\t\tldi\t&PARSESTRING"$1"\n\t\tpushi\t0\n\t\tcall\t&TESTSAID\t0\n\n" }' + cat ${ASM_BODY}; + echo ""; + echo ".said"; + echo "SPEC0: ${SPEC}" + echo "" + echo ".strings" + echo "FILENAME: \"${DEST_FILE}\"" + cat ${INDEX_FILE} | awk '{ psn=$1; $1=""; print "PARSESTRING"psn"\t: \""substr($0,2)"\"\n" }' +) > ${ASM_FILE} + +${SCIS} -q ${ASM_FILE} -o ${DEST_DIR}/script.000 +(${RUNNER}) > ${TMP_DIR}/log 2> ${TMP_DIR}/log +mv ${SCI_WORK_DIR}/${DEST_FILE} ${OUTPUT_DIR}/ Property changes on: freesci/trunk/tests/parser/data/run-test.sh ___________________________________________________________________ Name: svn:executable + * Added: freesci/trunk/tests/parser/data/shuffle.sml =================================================================== --- freesci/trunk/tests/parser/data/shuffle.sml 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/data/shuffle.sml 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,24 @@ + +fun printall words = + let fun dumpall wl = print (String.concatWith " " wl); + in (dumpall words; + print "\n") + end; + +fun try_all _ [] = () + | try_all f l = let fun foreach lhs (h::tl) = (f h ([EMAIL PROTECTED]); + foreach (lhs @ [h]) tl) + | foreach _ _ = (); + in foreach [] l + end; + +fun with_word head w rest = let val stub = head @ [w] + in (printall stub; + try_all (with_word stub) rest) + end; + +print "@@START\n"; +val _ = try_all (with_word []) words; +print "@@END\n"; + +OS.Process.exit 0; Added: freesci/trunk/tests/parser/run-all.sh =================================================================== --- freesci/trunk/tests/parser/run-all.sh 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/run-all.sh 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,69 @@ +#! /bin/bash + +. config + +DATA_DIR=data +TEST_SPECS=test-specs + + +RUN_SSCI=run-ssci.sh +RUN_FSCI=run-fsci.sh +RUN_DIFF=diff.sh + +STATS_DIR=${DATA_DIR}/stats + +WITH_SSCI=yes + +while [ x$1 != x ]; do + case $1 in + -h) echo "$0: Supported paramters:" + echo " --fast : Disable re-computation of SSCI results" + ;; + --fast) + WITH_SSCI=no + echo "Disabling SSCI re-computation." + ;; + esac + shift +done + + +COUNT=0 +TESTS_TOTAL=0 +FP_TOTAL=0 +FN_TOTAL=0 + +for w in `cat ${TEST_SPECS} | tr ' ' '_'`; do + INDEX=`printf "%03x" ${COUNT}` + SPEC=`echo $w | tr '_' ' '` + + if [ x${VERBOSE} != x ] ; then + echo "--- Spec #${INDEX} = ${SPEC}" + fi + + COUNT=$(( COUNT + 1 )) + (cd ${DATA_DIR} + if [ x${WITH_SSCI} != xno ]; then + ./${RUN_SSCI} "${SPEC}" ${INDEX} + fi + ./${RUN_FSCI} "${SPEC}" ${INDEX} + ./${RUN_DIFF} ${INDEX} + ) + + FP_FILE=${STATS_DIR}/false-positive.${INDEX} + FN_FILE=${STATS_DIR}/false-negative.${INDEX} + COUNT_FILE=${STATS_DIR}/count.${INDEX} + + LOCAL_TESTS=`cat ${COUNT_FILE}` + LOCAL_FP=`wc -l ${FP_FILE} | awk '{print $1}'` + LOCAL_FN=`wc -l ${FN_FILE} | awk '{print $1}'` + + TESTS_TOTAL=$(( TESTS_TOTAL + LOCAL_TESTS )) + FP_TOTAL=$(( FP_TOTAL + LOCAL_FP )) + FN_TOTAL=$(( FN_TOTAL + LOCAL_FN )) +done + +echo "Tested ${COUNT} specs, for a total of ${TESTS_TOTAL} test cases." +echo "False Positives: ${FP_TOTAL}" +echo "False Negatives: ${FN_TOTAL}" + Property changes on: freesci/trunk/tests/parser/run-all.sh ___________________________________________________________________ Name: svn:executable + * Added: freesci/trunk/tests/parser/test-specs =================================================================== --- freesci/trunk/tests/parser/test-specs 2006-02-25 19:13:25 UTC (rev 1565) +++ freesci/trunk/tests/parser/test-specs 2006-02-27 02:12:39 UTC (rev 1566) @@ -0,0 +1,7 @@ +look-474 / room-804 +shine-48b < up-142 / light-93c +look-474 / appendage-89f [ < bone-94a , protrusion-97d [ < metallic-24a ] ] +drive-4ab / ship-958 [ < ( tree-848 < snake-958 ) , bone-94a ] + + + _______________________________________________ FreeSCI-develop mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freesci-develop
