@echo off

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

rem Tests   1-2      sample

SET PROBLEM_NAME=equal
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

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 1 1
gen_random 1 2
gen_random 1 1000
gen_random 123 12345
gen_random 1 1000000000
gen_random 999999999 1000000000
gen_random 1234567 1000000000
gen_random 1299709 179424673
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random
gen_random



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
  )
)