tests: integration: check when trade enabled

This commit is contained in:
Bruno BELANYI 2022-03-12 14:03:06 +01:00
parent 832abfb224
commit 4b06f591c6

View file

@ -31,6 +31,19 @@ test_file() {
fi fi
} }
test_file_trades() {
if ! diff="$(diff <("$KRAKEN" --enable-trade < "$DATA_DIR/inputs/$1.in.csv") "$DATA_DIR/outputs/$1.trades.out.csv")"; then
((FAILURES += 1))
echo "$1 (trades): FAIL"
if [ -n "$VERBOSE" ]; then
printf '%s\n' "$diff"
fi
else
((SUCCESSES += 1))
echo "$1 (trades): OK"
fi
}
for test_name in "$DATA_DIR"/inputs/*.in.csv; do for test_name in "$DATA_DIR"/inputs/*.in.csv; do
test_name="$(basename "$test_name")" test_name="$(basename "$test_name")"
test_name="${test_name%%.in.csv}" test_name="${test_name%%.in.csv}"
@ -38,6 +51,13 @@ for test_name in "$DATA_DIR"/inputs/*.in.csv; do
test_file "$test_name" test_file "$test_name"
done done
for test_name in "$DATA_DIR"/outputs/*.trades.out.csv; do
test_name="$(basename "$test_name")"
test_name="${test_name%%.trades.out.csv}"
test_file_trades "$test_name"
done
printf '\nSummary: %d successes, %d failures\n' "$SUCCESSES" "$FAILURES" printf '\nSummary: %d successes, %d failures\n' "$SUCCESSES" "$FAILURES"
exit "$((FAILURES != 0))" exit "$((FAILURES != 0))"