@echo off

set problem=hear
set author=ek

echo Generating tests...

cd src
javac TestGen.java
java TestGen

cd ..

copy ..\\..\\lib\testlib4j.jar testlib4j.jar

call javac -classpath testlib4j.jar Check.java -encoding utf8 
call jar cf Check.jar *.class
    
echo Generating answers...

g++ -O2 -o %problem%_%author%.exe %problem%_%author%.cpp
rem javac %problem%_%author%.java -encoding utf8

for %%i in (tests\??) do (
    echo Test %%i
    copy %%i %problem%.in > nul
    %problem%_%author%.exe
    rem java -Xmx256M -Xss64M %problem%_%author%
    copy %problem%.out %%i.a > nul
    echo Check %%i
    java -Xmx256M -Xss64M -cp ../../lib/testlib4j.jar;Check.jar ru.ifmo.testlib.CheckerFramework Check %%i %%i.a %%i.a
)
