Skip to content
Snippets Groups Projects
Commit eeb079f4 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

make former derivation and integral tests working

parent a4d5c7af
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ int main(int argc, char** argv) { ...@@ -42,7 +42,7 @@ int main(int argc, char** argv) {
} }
} }
   
if(false){ {
regexp::RegExp regexp = alib::DataFactory::fromTokens<regexp::RegExp>(regexpTokens); regexp::RegExp regexp = alib::DataFactory::fromTokens<regexp::RegExp>(regexpTokens);
string::LinearString string = alib::DataFactory::fromTokens<string::LinearString>(stringTokens); string::LinearString string = alib::DataFactory::fromTokens<string::LinearString>(stringTokens);
alib::DataFactory::toStdout(regexp::RegExpDerivation::derivation(regexp, string)); alib::DataFactory::toStdout(regexp::RegExpDerivation::derivation(regexp, string));
......
...@@ -42,7 +42,7 @@ int main(int argc, char** argv) { ...@@ -42,7 +42,7 @@ int main(int argc, char** argv) {
} }
} }
   
if(false){ {
regexp::RegExp regexp = alib::DataFactory::fromTokens<regexp::RegExp>(regexpTokens); regexp::RegExp regexp = alib::DataFactory::fromTokens<regexp::RegExp>(regexpTokens);
string::LinearString string = alib::DataFactory::fromTokens<string::LinearString>(stringTokens); string::LinearString string = alib::DataFactory::fromTokens<string::LinearString>(stringTokens);
alib::DataFactory::toStdout(regexp::RegExpIntegral::integral(regexp, string)); alib::DataFactory::toStdout(regexp::RegExpIntegral::integral(regexp, string));
......
...@@ -53,6 +53,7 @@ debug : all-debug ...@@ -53,6 +53,7 @@ debug : all-debug
cp $$dir/bin-debug/* $(addsuffix -debug, $(BINFOLDER)); \ cp $$dir/bin-debug/* $(addsuffix -debug, $(BINFOLDER)); \
done done
./tests.aconversion.sh debug ./tests.aconversion.sh debug
./tests.aderivation.aintegral.sh debug
   
release: all-release release: all-release
mkdir -p $(addsuffix -release, $(BINFOLDER)) mkdir -p $(addsuffix -release, $(BINFOLDER))
...@@ -64,6 +65,7 @@ release: all-release ...@@ -64,6 +65,7 @@ release: all-release
cp $$dir/bin-release/* $(addsuffix -release, $(BINFOLDER)); \ cp $$dir/bin-release/* $(addsuffix -release, $(BINFOLDER)); \
done done
./tests.aconversion.sh release ./tests.aconversion.sh release
./tests.aderivation.aintegral.sh debug
   
clean : clean-debug clean-release clean : clean-debug clean-release
$(RM) -r bin-debug bin-release $(RM) -r bin-debug bin-release
......
#!/usr/bin/env bash #!/usr/bin/env bash
   
# $1 test dir suffix (debug / release)
set -o pipefail set -o pipefail
   
EXECUTABLES="aepsilon atrim adeterminize aminimize anormalize adiff.automaton aderivation aintegral" EXECUTABLES="aepsilon2 atrim2 adeterminize2 aminimize2 anormalize2 adiff2 aderivations2 aintegral2 aconversions2"
TESTS_DIR="../examples/regexp" TESTS_DIR="../examples2/regexp"
   
# ---------------------------- # ----------------------------
   
for FILE in $EXECUTABLES; do for FILE in $EXECUTABLES; do
if [ ! -f bin/$FILE ]; then if [ ! -f bin-$1/$FILE ]; then
echo "Executable" $FILE "is required for testing. Make sure it is in bin folder." echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder."
exit 1 exit 1
fi fi
done done
   
cd bin/ cd bin-$1/
   
# ---------------------------- # ----------------------------
   
function regexpToMDFA { function regexpToMDFA {
echo "$1" | ./aconversion -t FSM | ./aepsilon | ./atrim | ./adeterminize -t FSM | ./aminimize | ./anormalize echo "$1" | ./aconversions2 -t FSM | ./aepsilon2 | ./atrim2 | ./adeterminize2 -t FSM | ./aminimize2 | ./anormalize2
} }
   
function compareRegexp { function compareRegexp {
...@@ -27,7 +29,7 @@ function compareRegexp { ...@@ -27,7 +29,7 @@ function compareRegexp {
regexpToMDFA "$2" > tmp2.xml regexpToMDFA "$2" > tmp2.xml
   
# relies on ret code by adiff.automaton # relies on ret code by adiff.automaton
./adiff.automaton tmp1.xml tmp2.xml > /dev/null ./adiff2 tmp1.xml tmp2.xml > /dev/null
RET=$? RET=$?
rm tmp1.xml tmp2.xml rm tmp1.xml tmp2.xml
   
...@@ -61,7 +63,7 @@ function runTestD { ...@@ -61,7 +63,7 @@ function runTestD {
FILE_REGEXP_RESULT=$(echo "$2") FILE_REGEXP_RESULT=$(echo "$2")
shift 2 shift 2
   
REGEXP_DERIVATIVE=$(cat $TESTS_DIR/$FILE_REGEXP_ORIG | ./aderivation $@) REGEXP_DERIVATIVE=$(./aconvert2 --string_from_string <<< "$1" | ./aderivations2 -r $TESTS_DIR/$FILE_REGEXP_ORIG -s - )
REGEXP_RESULT=$(cat $TESTS_DIR/$FILE_REGEXP_RESULT) REGEXP_RESULT=$(cat $TESTS_DIR/$FILE_REGEXP_RESULT)
runTest "$REGEXP_DERIVATIVE" "$REGEXP_RESULT" runTest "$REGEXP_DERIVATIVE" "$REGEXP_RESULT"
} }
...@@ -71,7 +73,7 @@ function runTestI { ...@@ -71,7 +73,7 @@ function runTestI {
FILE_REGEXP_RESULT=$(echo "$2") FILE_REGEXP_RESULT=$(echo "$2")
shift 2 shift 2
   
REGEXP_INTEGRAL=$(cat $TESTS_DIR/$FILE_REGEXP_ORIG | ./aintegral $@) REGEXP_INTEGRAL=$(./aconvert2 --string_from_string <<< "$1" | ./aintegral2 -r $TESTS_DIR/$FILE_REGEXP_ORIG -s - )
REGEXP_RESULT=$(cat $TESTS_DIR/$FILE_REGEXP_RESULT) REGEXP_RESULT=$(cat $TESTS_DIR/$FILE_REGEXP_RESULT)
   
runTest "$REGEXP_INTEGRAL" "$REGEXP_RESULT" runTest "$REGEXP_INTEGRAL" "$REGEXP_RESULT"
...@@ -80,17 +82,17 @@ function runTestI { ...@@ -80,17 +82,17 @@ function runTestI {
   
# derivatives # derivatives
echo "Derivatives" echo "Derivatives"
runTestD "oppa-4-13.xml" "oppa-4-13.d0.xml" "0" runTestD "unbounded.oppa.4.13.xml" "unbounded.oppa.4.13.d0.xml" "\"0\""
runTestD "oppa-4-13.xml" "oppa-4-13.d00.xml" "0" "0" runTestD "unbounded.oppa.4.13.xml" "unbounded.oppa.4.13.d00.xml" "\"0 0\""
runTestD "oppa-4-14.xml" "oppa-4-14.d1.xml" "1" runTestD "unbounded.oppa.4.14.xml" "unbounded.oppa.4.14.d1.xml" "\"1\""
runTestD "oppa-4-14.xml" "oppa-4-14.d10.xml" "1" "0" runTestD "unbounded.oppa.4.14.xml" "unbounded.oppa.4.14.d10.xml" "\"1 0\""
runTestD "oppa-4-15.xml" "oppa-4-15.d100.xml" "1" "0" "0" runTestD "unbounded.oppa.4.15.xml" "unbounded.oppa.4.15.d100.xml" "\"1 0 0\""
   
# integrals # integrals
echo "" echo ""
echo "Integrals" echo "Integrals"
runTestI "oppa-4-16.xml" "oppa-4-16.i1.xml" "1" runTestI "unbounded.oppa.4.16.xml" "unbounded.oppa.4.16.i1.xml" "\"1\""
runTestI "Melichar2-94.xml" "Melichar2-94.i0.xml" "0" runTestI "Melichar2-94.xml" "Melichar2-94.i0.xml" "\"0\""
runTestI "Melichar2-94.xml" "Melichar2-94.i1.xml" "1" runTestI "Melichar2-94.xml" "Melichar2-94.i1.xml" "\"1\""
   
echo "" echo ""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment