#!/bin/sh # Test ../fribidi with reference/bidiref, using stdin, and diff the outputs. # use --debug switch to see the debug info into stderr. path=`dirname $0` if ! test -f "$path/../fribidi"; then echo "test: you must make fribidi first" exit 1 fi if ! test -f "$path/reference/bidiref"; then # fribidi does not set MAX_LEVEL to 15 if debug enabled, then reference # should not be compiled with debug enabled. # if test -z "`echo -n | $path/../fribidi --debug 2>&1`"; then # debug="-DDEBUGGING" # else # debug="" # fi debug="" g++ $debug -o $path/reference/bidiref $path/reference/bidiref.cpp fi convertsub () { refline="`echo \"$refline\" | sed s/$1/$2/g`" } p1="--clean" p2="-clean" while [ -n "$1" ]; do if test "$1" = "--debug"; then p1=$p1" --debug" p2=$p2" -verbose" else par=$par" $1" fi shift done > $path/test.out > $path/test.ref cat $par | while read line; do echo "$line" | $path/../fribidi --charset CapRTL --nopad $p1 >> $path/test.out # echo "$line" | $path/reference/bidiref $p2 >> $path/test.ref refline="$line" convertsub "_R" "`echo -e \"\\16\"`" convertsub "_r" "`echo -e \"\\17\"`" convertsub "_L" "`echo -e \"\\20\"`" convertsub "_l" "`echo -e \"\\21\"`" convertsub "_o" "`echo -e \"\\22\"`" refline=`echo "$refline" | $path/reference/bidiref $p2` convertsub "`echo -e \"\\16\"`" "_R" convertsub "`echo -e \"\\17\"`" "_r" convertsub "`echo -e \"\\20\"`" "_L" convertsub "`echo -e \"\\21\"`" "_l" convertsub "`echo -e \"\\22\"`" "_o" echo "$refline" >> $path/test.ref done diff $path/test.out $path/test.ref