@echo off

rem =============================
rem =                           =
rem =    Test descriptions      =
rem =                           =
rem =============================

rem Tests   1-2      sample

SET PROBLEM_NAME=reverse
SET FIRST_GENERATED_TEST=2
SET EXECUTABLE=..\solution.exe
SET MAXIMUM_TESTS=200

rem =============================
rem =                           =
rem =         Compiling         =
rem =                           =
rem =============================

echo Compiling...

dcc32 -CC gen_random >nul
dcc32 -CC gen_random2 >nul

rem =============================
rem =                           =
rem =       Delete files        =
rem =                           =
rem =============================

echo Deleting old files

del "%~dp0*.out" > nul

for /l %%i in (%FIRST_GENERATED_TEST%,1,%MAXIMUM_TESTS%) do (
  if exist %%i.in (
    del %%i.in > nul
  )
)

rem =============================
rem =                           =
rem =     Generating tests      =
rem =                           =
rem =============================

echo Generating tests...


gen_random 10 2
gen_random 100 2
gen_random 201 2
gen_random 1000 2
gen_random 10001 2
gen_random 100000 2
gen_random 100000 2
gen_random 100000 2
gen_random 100000 2
gen_random 100000 1
gen_random 100000 1
gen_random 100000 1
gen_random 100000 1
gen_random2 100000
gen_random2 99999




rem =============================
rem =                           =
rem =      Making answers       =
rem =                           =
rem =============================

echo Getting answers with model solution

for /l %%i in (1,1,%MAXIMUM_TESTS%) do (
  if exist %%i.in (
    copy %%i.in %PROBLEM_NAME%.in > nul
    %EXECUTABLE% > nul
    copy %PROBLEM_NAME%.out %%i.out > nul
    del %PROBLEM_NAME%.in > nul
    del %PROBLEM_NAME%.out > nul
  )
)