#!/bin/bash

TESTS_DIR="../tests"
#mkdir $TESTS_DIR

g++ -O2 -std=c++11 test_gen.cpp -o test_gen
./test_gen

cp ../author/author.cpp .
cp ../system/grader.cpp .
cp ../system/oriand.h .
g++ -O2 -std=c++11 author.cpp grader.cpp -o author

for in_file in "$TESTS_DIR"/*.in; do
    if [[ -f "$in_file" ]]; then
	out_file="${in_file%.in}.out"
        echo "Processing $out_file"
	./author < $TESTS_DIR/$in_file > $TESTS_DIR/$out_file
    fi
done

rm author
rm author.cpp
rm test_gen
rm grader.cpp
rm oriand.h
rm -f test_gen.o
rm -f test_gen.exe

