Need to write three programs, makedata.exe generate test data,
program1.exe is the program you want to detect, program2.exe often is the right but not efficient (mostly violent) program.
The code is simple, brief explanation
: loop // loop represents the cycle begins
makedata.exe // run to generate a set of test data makedata.exe
program1.exe // run the first program
program2.exe // run a second program
// compare the contents of two output fc program1.out program2.out, two out on the same line
IF % ERRORLEVEL% == 0 GOTO Loop // if exactly the same output, the test cycle continues next set of data
pause // otherwise stop
Red marks are particularly vulnerable to wrong phrase, consistent == 0, said == 1 indicates that there are different, pay attention to this if statement does not then.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 另外一种写法<<<<<<<<<<<<<<<<<<<<<<<<<
:loop
makedata.exe
program1.exe program2.exe
comp program1.out program2.out /A /L
goto loop
Reproduced in: https: //www.cnblogs.com/jznoi/p/4070430.html