### futurechampion's blog

By futurechampion, history, 3 months ago, ,

My question in title .I will be glad if you help me.

•
• +10
•

 » 3 months ago, # | ← Rev. 3 →   +49 @echo off REM The line above prevents commands from being printed before execution REM Type 'for /?' in command prompt for detailed help about for's options REM Note that you should use double % sign in scripts, and single % sign in command prompt REM For's variables should always be single-letter for %%t in (*.in) do ( REM There are special forms of accessing for's variable, see for /? solution <%%t >%%~nt.out || exit /b REM a || b means 'run a, if it fails, run b'. REM In the next line, if 'fc' (file compare) fails, REM then 'exit /b' is called (closes current batch script, but not the command prompt) fc %%~nt.out %%~nt.ans || exit /b ) echo ok Feel free to ask any questions you have about the script.
•  » » 3 months ago, # ^ |   +27 Here is how it works: suppose you have a compiled solution.exe in the current working directory (it should read from stdin and print to stdout, no file I/O at all), as well as your tests: 01.in (first input), 01.ans (expected output for the first input), 02.in, 02.ans, ..., complex.in, complex.ans (it's not necessary for the test name to be a number). Now, if you save the script here as testall.cmd (or testall.bat, whatever, I prefer the former), you can run it from command prompt and check its output.So, directory structure may go like this: D:\work\180522 |- solution.exe |- 01.in |- 01.ans |- 02.in |- 02.ans |- complex.in |- complex.ans |- testall.cmd If you type the following in command prompt (cmd.exe), it should run the solution on all tests: D: cd D:\work\180522 testall It will test until the solution fails or its output (stored in 01.out, 02.out, complex.out) does not match the expected output. If something goes wrong, the script terminates. If everything goes well, it ends and prints ok in the very end.
•  » » » 3 months ago, # ^ |   0 thanks very much for help ! I will try.