From: <br...@us...> - 2008-06-04 21:24:37
|
Revision: 214 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=214&view=rev Author: brus07 Date: 2008-06-04 14:24:40 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Work with real Tester. Modification of logging. Modified Paths: -------------- ACMServer/trunk/TesterSolution/Checker/Checker.csproj ACMServer/trunk/TesterSolution/Checker/Class1.cs ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs Added Paths: ----------- ACMServer/trunk/TesterSolution/Checker/InData.txt ACMServer/trunk/TesterSolution/Checker/SourceTest.dll Modified: ACMServer/trunk/TesterSolution/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-04 21:24:40 UTC (rev 214) @@ -28,6 +28,10 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="SourceTest, Version=1.0.3077.22878, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>.\SourceTest.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> @@ -36,6 +40,11 @@ <Compile Include="Class1.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> + <ItemGroup> + <Content Include="InData.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: ACMServer/trunk/TesterSolution/Checker/Class1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -1,13 +1,50 @@ using System; using System.Collections.Generic; using System.Text; +using SourceTest; +using System.IO; namespace Checker { public class Checker { - public static int GetResult(string code) + static void func(int x, TResult res) { + Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); + } + + public static string GetResult(string message) + { + string code = message.Substring(message.IndexOf('$')+1); + string id = message.Substring(0,message.IndexOf('$')); + TSource c = new TSource(); + StreamReader s = new StreamReader("InData.txt", Encoding.Default); + String compiler = s.ReadLine(); + String problem = s.ReadLine(); + String temp = s.ReadLine(); + String source = s.ReadLine(); + s.Close(); + //s = File.OpenText(source); + c.CompPath = compiler; + c.ProblemPath = problem; + c.LoadLimits(); + c.Src = code; + //c.Src = s.ReadToEnd(); + //s.Close(); + c.TempPath = temp; + c.TestHandler += new TTestHandler(func); + c.Language = (TLang)1; + c.ProcessAll(); + Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); + Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + Console.WriteLine("Points: {0}", c.Summary.res.points); + Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + return TSource.TestResultToString(c.Summary.res.res); + } + public static int GetResult1(string code) + { code = (code.Split(' '))[1]; int res = 0; for (int i = 0; i < code.Length; i++) Added: ACMServer/trunk/TesterSolution/Checker/InData.txt =================================================================== --- ACMServer/trunk/TesterSolution/Checker/InData.txt (rev 0) +++ ACMServer/trunk/TesterSolution/Checker/InData.txt 2008-06-04 21:24:40 UTC (rev 214) @@ -0,0 +1,4 @@ +d:\SAMPLE\D7.bat +d:\SAMPLE\Test\ +d:\SAMPLE\Temp\ +d:\SAMPLE\source.txt Added: ACMServer/trunk/TesterSolution/Checker/SourceTest.dll =================================================================== (Binary files differ) Property changes on: ACMServer/trunk/TesterSolution/Checker/SourceTest.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -36,16 +36,20 @@ this.button3 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // textBox1 // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.Location = new System.Drawing.Point(12, 90); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBox1.Size = new System.Drawing.Size(268, 158); this.textBox1.TabIndex = 0; // @@ -104,17 +108,17 @@ this.statusStrip1.TabIndex = 6; this.statusStrip1.Text = "statusStrip1"; // - // timer1 - // - this.timer1.Enabled = true; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); - // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17); this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -51,8 +51,9 @@ private void DataArrived(string message) { textBox1.Text += "\r\n" + message; - int result = Checker.Checker.GetResult(message); - socket.Send(result.ToString() + " " + message); + string result = Checker.Checker.GetResult(message); + textBox1.Text += "\r\n\t-> " + result; + socket.Send(result.ToString() + "$" + message); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |