#!/bin/sh -eu

STEPS=100
FAIL=false


echo check SAT tests
if find tests/sat -name "*.smt2" | parallel "$@" --timeout 200 --joblog sat.log "./neno 1 bundle/colibri --max-steps $STEPS {}"; then
    echo OK
else
    echo KO
    awk '$7 == -1' sat.log
    FAIL=true
fi

echo check UNSAT tests
if find tests/unsat -name "*.smt2" | parallel "$@" --timeout 200  --joblog unsat.log "./neno 0 bundle/colibri --max-steps $STEPS {}"; then
    echo OK
else
    echo KO
    awk '$7 == -1' unsat.log
    FAIL=true
fi

echo check UNKNOWN tests
if find tests/unknown -name "*.smt2" | parallel "$@" --timeout 200  --joblog unknown.log "./neno 2 bundle/colibri --max-steps $STEPS {}"; then
    echo OK
else
    awk '$7 == -1' unknown.log
    FAIL=true
fi

if $FAIL; then exit 1; fi

#echo check TIMEOUT tests
#find tests/timeout -name "*.smt2" | parallel "$@" --timeout 200  --joblog timeout.log "./neno 2 bundle/colibri --max-steps $STEPS {}" || (awk '$7 != -1' timeout.log && false)
