@echo off
set prob=number
set model=md

for /L %%i in (1,1,9) do (
  call dcc32 -cc do0%%i.dpr > nul
  do0%%i.exe > 0%%i
  echo Test 0%%i: input generated
)
for /L %%i in (10,1,16) do (
  call dcc32 -cc do%%i.dpr > nul
  do%%i.exe > %%i
  echo Test %%i: input generated
)
for /L %%i in (17,1,18) do (
  call javac do%%i.java > nul
  java do%%i > %%i
  echo Test %%i: input generated
)
for /L %%i in (19,1,30) do (
  call dcc32 -cc do%%i.dpr > nul
  do%%i.exe > %%i
  echo Test %%i: input generated
)
del do??.class
del do??.exe

echo Compiling model solution
copy ..\%prob%_%model%.dpr %prob%_%model%.* > nul
call dcc32 -cc %prob%_%model%.dpr
for %%i in (??) do (
  copy %%i %prob%.in > nul
  %prob%_%model%.exe
  copy %prob%.out %%i.a > nul
  echo Test %%i: output generated
)
del %prob%.in
del %prob%.out
del %prob%_%model%.dpr

copy ..\check.dpr check.dpr > nul
dcc32 -cc check.dpr

set tested=sd
echo ----- TESTING %tested% -----
copy ..\%prob%_%tested%.cpp %prob%_%tested%.cpp > nul
rem call gcc %prob%_%tested%.cpp -o %prob%_%tested%.exe > nul
call cl %prob%_%tested%.cpp > nul
del %prob%_%tested%.obj
for %%i in (??) do (
  copy %%i %prob%.in > nul
  %prob%_%tested%.exe
  check %%i %prob%.out %%i.a
)
del %prob%.in
del %prob%.out
del %prob%_%tested%.cpp
del %prob%_%tested%.exe

set tested=pm
echo ----- TESTING %tested% -----
copy ..\%prob%_%tested%.java %prob%_%tested%.java > nul
javac %prob%_%tested%.java > nul
for %%i in (??) do (
  copy %%i %prob%.in > nul
  java %prob%_%tested%
  check %%i %prob%.out %%i.a
)
del %prob%.in
del %prob%.out
del %prob%_%tested%.java

del check.dpr
del check.exe

del *.exe
del *.class