⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vince's test system.pas

📁 一款由河南省实验中学中加班学生开发的开源Pascal评测系统。。。
💻 PAS
字号:
{}{}{}{}{}{}{}{}{}{}{}{}{
*************************
Vince's Test systen Beta
************************
Dec. 13th, 2008 Fri.
                By Vince
*************************
}{}{}{}{}{}{}{}{}{}{}{}{}

uses dos,sysutils;
var
        t1,t2:text;
        t1s,t2s,ts,s:string;
	q1,q2,i,yes,no,allt:longint;
        b,d:boolean;
        mark:real;
        dbb,dee,bb,ee,blank:word;
        dir:searchrec;
function ns(ii:longint):string;
begin
        str(ii,ns);
end;
procedure com(comm:string);
begin
        exec(fexpand(paramstr(1))+'tools\dos.exe','/c '+comm);
end;
procedure check;
begin
        b:=true;
        assign(t1,fexpand(paramstr(1))+'compile\'+s+'.out');
        assign(t2,fexpand(paramstr(1))+'data\'+s+'\'+ns(q1)+'.out');
        reset(t1);
        reset(t2);
        while (b=true)and((not(eof(t1)))or(not(eof(t2)))) do
        begin
                if not(eof(t2))then
                begin
                        if not(eof(t1))then
                        begin
                                readln(t1,t1s);
                                readln(t2,t2s);
                                if t1s<>t2s then b:=false;
                        end else b:=false;
                end else if not(eof(t1)) then b:=false;
        end;
        close(t1);
        close(t2);
end;
begin
	writeln('赵文轩Pascal程序评测系统 测试版');
	write('请输入测试的文件:');
        readln(s);
        {09.02.27}
	{write('清输入测试点数目:');
	readln(i); }
        {/09.02.27}
	for q1:=1 to length(s) do if s[q1]='.' then break;
	for q2:=q1+1 to length(s) do ts:=ts+s[q2];
	if ts='pas' then s:=copy(s,1,q1-1);
        exec(fexpand(paramstr(1))+'tools\compile.exe',fexpand(paramstr(1))+'compile\'+s+'.pas');
        com('cls');
        ts:=fsearch(s+'.exe',fexpand(paramstr(1))+'compile\');
        if ts='' then
        begin
                writeln('编译未通过,按任意键退出...');
                readln;
                exit;
        end else
        begin
                writeln('编译完毕,开始测试!');
                writeln('========================');
        end;
	for q1:={09.03.11}{1}0{/09.03.11} to 100 do
        {09.02.27}
        if not(fileexists('data\'+s+'\'+ns(q1)+'.in')) then {09.03.18}{if q1>3 then}{/09.03.18}
        begin
                i:=q1-1;
                break;
        end else
        {/09.02.27}
        begin
                com('copy data\'+s+'\'+ns(q1)+'.in compile\'+s+'.in>nul');
                gettime(blank,blank,dbb,bb);
                com('cd compile&'+s);
                gettime(blank,blank,dee,ee);
                check;
                if b=true then
		begin
			writeln('第',q1,'题 正确! 耗时',(dee-dbb)*100+ee-bb,'毫秒');
			yes:=yes+1;
		end else
		begin
			writeln('第',q1,'题 错误! 耗时',(dee-dbb)*100+ee-bb,'毫秒');
			no:=no+1;
		end;
		allt:=allt+(dee-dbb)*100+ee-bb;
        end;
        writeln('========================');
        mark:=yes*100/{09.03.31}{i}(i+1){/09.03.31};
        {09.03.18}if not(fileexists('data\'+s+'\0.in')) then i:=i-1;{/09.03.18}
        writeln('本次测试共',{09.03.18}{i}i+1{/09.03.18},'个测试点');
	writeln('通过',yes:4,'个');
	writeln('失败',no:4,'个');
	writeln('耗时',allt:4,'毫秒');
	writeln('成绩',mark:4:0,'分');
	writeln('按任意键退出...');
	readln;
        com('del compile\'+s+'.o -q');
        com('del compile\'+s+'.in -q');
        com('del compile\'+s+'.out -q');
        com('del compile\'+s+'.exe -q');
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -