代码对拍器

 

bat文件

 

一个exe用于不断生成数据 (build)

另外两个exe输出结果并比较 (test1,test2)

一个文件夹存放结果(addr)

 

 1 @echo off
 2 setlocal enabledelayedexpansion
 3 
 4 ::here, build test data, correct result, and test the output of several exe
 5 
 6 
 7 set build=C:\Users\lenovo\Desktop\data\bin\Debug\data.exe
 8 set correct=C:\Users\lenovo\Desktop\code\bin\Debug\code.exe
 9 set test1=C:\Users\lenovo\Desktop\code1.exe
10 set test2=C:\Users\lenovo\Desktop\code2.exe
11 set test3=C:\Users\lenovo\Desktop\code3.exe
12 set test4=C:\Users\lenovo\Desktop\code4.exe
13 set test5=C:\Users\lenovo\Desktop\code5.exe
14 set test6=C:\Users\lenovo\Desktop\code6.exe
15 set test7=C:\Users\lenovo\Desktop\code7.exe
16 set test8=C:\Users\lenovo\Desktop\code8.exe
17 set test9=C:\Users\lenovo\Desktop\code9.exe
18 set addr=C:\Users\lenovo\Desktop\result
19 
20 if not exist %addr% (
21     md %addr%
22 )
23 
24 for /l %%i in (1,1,1000) do (
25     cd %addr%
26     %build% >data_%%i.txt
27     %correct% <data_%%i.txt >correct_%%i.txt
28 
29     %test1% <data_%%i.txt >test1_%%i.txt
30     fc test1_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 1 not same %%i
31 
32     %test2% <data_%%i.txt >test2_%%i.txt
33     fc test2_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 2 not same %%i
34 
35     %test3% <data_%%i.txt >test3_%%i.txt
36     fc test3_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 3 not same %%i
37 
38     set /a j=%%i%%10
39     if !j! equ 0 (
40         echo %%i th
41     )
42 )
43 
44 pause

 

 

 

 

 

 

 

 1 @echo off
 2 setlocal enabledelayedexpansion
 3 
 4 ::here, build test data, correct result, and test the output of several exe
 5 
 6 
 7 set build="../data/bin/Debug/data.exe"
 8 set correct="../code/bin/Debug/code.exe"
 9 set test1="../code1.exe"
10 set test2="../code2.exe"
11 set test3="../code3.exe"
12 set test4="../code4.exe"
13 set test5="../code5.exe"
14 set test6="../code6.exe"
15 set test7="../code7.exe"
16 set test8="../code8.exe"
17 set test9="../code9.exe"
18 set addr="C:\Users\scientific\Desktop\编程题目\L3015_测试\result"
19 
20 if not exist %addr% (
21     md %addr%
22 )
23 
24 for /l %%i in (1,1,1000) do (
25     cd %addr%
26     %build% >data_%%i.txt
27     %correct% <data_%%i.txt >correct_%%i.txt
28 
29     %test1% <data_%%i.txt >test1_%%i.txt
30     fc test1_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 1 not same %%i
31 
32     %test2% <data_%%i.txt >test2_%%i.txt
33     fc test2_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 2 not same %%i
34 
35     %test3% <data_%%i.txt >test3_%%i.txt
36     fc test3_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 3 not same %%i
37 
38     %test4% <data_%%i.txt >test4_%%i.txt
39     fc test4_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 4 not same %%i
40 
41     %test5% <data_%%i.txt >test5_%%i.txt
42     fc test5_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 5 not same %%i
43 
44     %test6% <data_%%i.txt >test6_%%i.txt
45     fc test6_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 6 not same %%i
46 
47     %test7% <data_%%i.txt >test7_%%i.txt
48     fc test7_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 7 not same %%i
49 
50     %test8% <data_%%i.txt >test8_%%i.txt
51     fc test8_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 8 not same %%i
52 
53     %test9% <data_%%i.txt >test9_%%i.txt
54     fc test9_%%i.txt correct_%%i.txt >nul && echo >nul  || echo 9 not same %%i
55 
56     set /a j=%%i%%10
57     if !j! equ 0 (
58         echo %%i th
59     )
60 )
61 
62 pause

 

posted @ 2019-03-26 20:01  congmingyige  阅读(355)  评论(0编辑  收藏  举报