From: <Or...@us...> - 2008-06-07 19:52:46
|
Revision: 227 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=227&view=rev Author: Oracle_ Date: 2008-06-07 12:51:51 -0700 (Sat, 07 Jun 2008) Log Message: ----------- Added Details to CheckAnswer procedure from DLL. Modified Paths: -------------- ACMServer/branches/sharp tester/ReadMe.txt ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.h ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h Modified: ACMServer/branches/sharp tester/ReadMe.txt =================================================================== --- ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 19:51:51 UTC (rev 227) @@ -26,13 +26,13 @@ \xF6\xE5 \xF8\xEB\xFF\xF5 \xE4\xEE \xF1\xEE\xF0\xF1\xE0, \xE0 \xE4\xF0\xF3\xE3\xE8\xE9 - \xF6\xE5 \xF8\xEB\xFF\xF5, \xE4\xE5 \xEF\xEE\xE2\xE8\xED\xED\xE8\xE9 \xF1\xF2\xE2\xEE\xF0\xE8\xF2\xE8\xF1\xFC EXE \xF4\xE0\xE9\xEB. \xC2\xF1\xB3 \xB3\xED\xF8\xB3 \xEE\xEF\xF6\xB3\xBF \xE2\xE8 \xEF\xEE\xE2\xE8\xED\xED\xB3 \xE2\xF1\xF2\xE0\xED\xEE\xE2\xE8\xF2\xE8 \xF1\xE0\xEC\xEE\xF1\xF2\xB3\xE9\xED\xEE (\xED\xE0\xEF\xF0\xE8\xEA\xEB\xE0\xE4 \xE7\xE0 \xE4\xEE\xEF\xEE\xEC\xEE\xE3\xEE\xFE *.bat \xF4\xE0\xE9\xEB\xF3). 4. TestLibrary \xCE\xC1\xCE\xC2'\xDF\xC7\xCA\xCE\xC2\xCE \xEF\xEE\xE2\xE8\xED\xED\xE0 \xE5\xEA\xF1\xEF\xEE\xF0\xF2\xF3\xE2\xE0\xF2\xE8 \xF2\xE0\xEA\xB3 \xF4\xF3\xED\xEA\xF6\xB3\xBF (\xB3\xED\xE0\xEA\xF8\xE5 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xEB\xEA\xE0 \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xEF\xE0\xE4\xE5): - bool CheckCL(char* src, int cl, char* details) - bool CheckDF(char* src, int lang, char* details) - bool CheckRTL(int usedrealtime, int realtimelimit) - bool CheckTL(int usedtime, int timelimit) - int CheckAnswer(char* input, char* output, char* rightoutput) - void FreeChar(char* buf); - \xE4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h + bool CheckCL(char* src, int cl, char*& details) - must check codelimit + bool CheckDF(char* src, int lang, char*& details) - must check DF + bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL + bool CheckTL(int usedtime, int timelimit) - must check TL + int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE + void FreeChar(char* buf); - must free memory used by buf + \xE4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h //////////////////////////////////////////////////////////////////////// ///////////////////////\xD1\xD2\xD0\xD3\xCA\xD2\xD3\xD0\xC0 \xD4\xC0\xC9˲\xC2///////////////////////////////// //////////////////////////////////////////////////////////////////////// Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-07 19:51:51 UTC (rev 227) @@ -292,7 +292,7 @@ } } -TCheckAnsRes TSource::CheckAnswer(int index,String^ output) //checks answer for test +TCheckAnsRes TSource::CheckAnswer(int index,String^ output, String^% Details) //checks answer for test { try { @@ -306,10 +306,12 @@ return carAC; } else { - char* buf1,*buf2,*buf3; + char* buf1,*buf2,*buf3,*buf4=NULL; TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); - TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output)); - FreeArr(buf1);FreeArr(buf2);FreeArr(buf3); + TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output),buf4); + Details+=gcnew String(buf4); + TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); + FreeArr(buf1);FreeArr(buf2);FreeArr(buf3);prc2(buf4); return res; } }__finally @@ -621,7 +623,7 @@ ReadFile(ouf,buf,size,&len,NULL); CloseHandle(ouf); - TCheckAnsRes r=CheckAnswer(index,gcnew String(buf)); + TCheckAnsRes r=CheckAnswer(index,gcnew String(buf),it->Details); delete[] buf; if (r==carAC) { Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-07 19:51:51 UTC (rev 227) @@ -236,7 +236,7 @@ typedef bool (*TCheckSrc)(char* src,int,char*& details); typedef bool (*TCheckLim)(int,int); - typedef int (*TCheckAnswer)(char* input, char* output, char* rightoutput); + typedef int (*TCheckAnswer)(char* input, char* output, char* rightoutput, char*& Details); typedef void (*TFreeFunc)(char* buf); public delegate void TTestHandler(int index, TResult^ res); @@ -275,11 +275,11 @@ TLang FLang; //language of source TSecure *FSecurity; //security class HMODULE lib; //library that must export: - //bool CheckCL(char* src, int cl, char* details) - must check codelimit - //bool CheckDF(char* src, int lang, char* details) - must check DF + //bool CheckCL(char* src, int cl, char*& details) - must check codelimit + //bool CheckDF(char* src, int lang, char*& details) - must check DF //bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL //bool CheckTL(int usedtime, int timelimit) - must check TL - //int CheckAnswer(char* input, char* output, char* rightoutput) - checks WA,OE,PE + //int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE //void FreeChar(char* buf); - must free memory used by buf //if there is no library called TestLibrary.dll then standart check is performed @@ -313,7 +313,7 @@ void Compile(); void RunTests(); //all tests void RunTest(int index); //only one test - TCheckAnsRes CheckAnswer(int index,String^ output); + TCheckAnsRes CheckAnswer(int index,String^ output, String^% Details); void ProcessAll(); //gets result for all tests void ProcessTest(int index); //gets result for only 1 test void LoadTest(int index,TTest% test); //load test from file Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-07 19:51:51 UTC (rev 227) @@ -33,8 +33,10 @@ return (usedtime*1.0>(timelimit*TLk+TLx)); } -TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput) +TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) { + Details=new char[30]; + strcpy(Details,"CheckAnswer from DLL\n"); if (strcmp(output,rightoutput)==0) return 0; int curo=0; Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-07 19:51:51 UTC (rev 227) @@ -12,5 +12,5 @@ TESTLIBRARY_API void FreeChar(char* buf); TESTLIBRARY_API bool CheckRTL(int usedrealtime, int realtimelimit); TESTLIBRARY_API bool CheckTL(int usedtime, int timelimit); -TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput); +TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |