Skip to content

Commit f299c78

Browse files
committed
updated latest truth version of codestorm 2.0
1 parent b6ddb03 commit f299c78

File tree

31 files changed

+273
-136
lines changed

31 files changed

+273
-136
lines changed

CodeStorm.sln

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BAB1E4B0-273C-484B-ABE4-2C98BC321B0F}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{2BE2604B-0190-4ED1-94EA-8AAE9397B8C8}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeStorm.Domain", "src\CodeStorm.Domain\CodeStorm.Domain.csproj", "{3E17DAB8-F9CF-40F4-A35E-55B1812574EF}"
11+
EndProject
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeStorm.Core", "src\CodeStorm.Core\CodeStorm.Core.csproj", "{0033B5A5-23F9-4667-B001-EF7F9D76BDCE}"
13+
EndProject
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeStorm.ConsoleApp", "src\CodeStorm.ConsoleApp\CodeStorm.ConsoleApp.csproj", "{582D4AF8-D55C-42F3-991E-2F1E20B1FD9F}"
15+
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeStorm.UnitTest", "test\CodeStorm.UnitTest\CodeStorm.UnitTest.csproj", "{61DCEE2B-FFB8-4FE0-9F51-274D09B60DCE}"
17+
EndProject
18+
Global
19+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20+
Debug|Any CPU = Debug|Any CPU
21+
Release|Any CPU = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{3E17DAB8-F9CF-40F4-A35E-55B1812574EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{3E17DAB8-F9CF-40F4-A35E-55B1812574EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{3E17DAB8-F9CF-40F4-A35E-55B1812574EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{3E17DAB8-F9CF-40F4-A35E-55B1812574EF}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{0033B5A5-23F9-4667-B001-EF7F9D76BDCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{0033B5A5-23F9-4667-B001-EF7F9D76BDCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{0033B5A5-23F9-4667-B001-EF7F9D76BDCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{0033B5A5-23F9-4667-B001-EF7F9D76BDCE}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{582D4AF8-D55C-42F3-991E-2F1E20B1FD9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{582D4AF8-D55C-42F3-991E-2F1E20B1FD9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{582D4AF8-D55C-42F3-991E-2F1E20B1FD9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{582D4AF8-D55C-42F3-991E-2F1E20B1FD9F}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{61DCEE2B-FFB8-4FE0-9F51-274D09B60DCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{61DCEE2B-FFB8-4FE0-9F51-274D09B60DCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{61DCEE2B-FFB8-4FE0-9F51-274D09B60DCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{61DCEE2B-FFB8-4FE0-9F51-274D09B60DCE}.Release|Any CPU.Build.0 = Release|Any CPU
40+
EndGlobalSection
41+
GlobalSection(SolutionProperties) = preSolution
42+
HideSolutionNode = FALSE
43+
EndGlobalSection
44+
GlobalSection(NestedProjects) = preSolution
45+
{3E17DAB8-F9CF-40F4-A35E-55B1812574EF} = {BAB1E4B0-273C-484B-ABE4-2C98BC321B0F}
46+
{0033B5A5-23F9-4667-B001-EF7F9D76BDCE} = {BAB1E4B0-273C-484B-ABE4-2C98BC321B0F}
47+
{582D4AF8-D55C-42F3-991E-2F1E20B1FD9F} = {BAB1E4B0-273C-484B-ABE4-2C98BC321B0F}
48+
{61DCEE2B-FFB8-4FE0-9F51-274D09B60DCE} = {2BE2604B-0190-4ED1-94EA-8AAE9397B8C8}
49+
EndGlobalSection
50+
GlobalSection(ExtensibilityGlobals) = postSolution
51+
SolutionGuid = {E3BF3E49-89B6-491D-90BF-6EBD5C0890BB}
52+
EndGlobalSection
53+
EndGlobal

assets/temporaryfiles/1.exe

-14.5 MB
Binary file not shown.

assets/temporaryfiles/2.exe

-129 KB
Binary file not shown.

assets/temporaryfiles/info.txt

Whitespace-only changes.

assets/temporaryfiles/main.exe

-14.5 MB
Binary file not shown.

src/CodeStorm.Core/Analyzers/MemoryAnalyzer.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using CodeStorm.Core.Helpers;
2-
using CodeStorm.Domain.Exceptions;
32
using System.Diagnostics;
43

54
namespace CodeStorm.Core.Analyzers
@@ -25,7 +24,7 @@ public void Start(int processId)
2524
thread.Start();
2625
}
2726

28-
public void Stop()
27+
public void Stop()
2928
{
3029
if (isActive) isActive = false;
3130
}
@@ -58,8 +57,7 @@ private void ControlMemoryUsage(int processId)
5857
}
5958
catch
6059
{
61-
//throw new SpecificSystemException(this.GetType().Name,"There is an error with MemoryAnalyzer", exception);
6260
}
63-
}
61+
}
6462
}
6563
}

src/CodeStorm.Core/Base/Checker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task<CheckerResult> CheckAsync(CheckerInput checkerInput)
2424
{
2525
var checker = checkerFactory.GetCompiledChecker(checkerInput.Language);
2626
string compiledFileName = checker.GetCompiledFileName(Path.GetFileName(checkerInput.SourceCodePath));
27-
string compiledFilePath = Path.Combine(checkerInput.MissionPath, compiledFileName);
27+
string compiledFilePath = Path.Combine(checkerInput.TemporaryPath, compiledFileName);
2828
string compilerName = checker.GetCompilerName();
2929
string compilerArgs = checker.GetCompilerArgs(checkerInput.SourceCodePath, compiledFilePath);
3030
var compilationResult = await compiler.CompileAsync(compilerName, compilerArgs, compiledFilePath);

src/CodeStorm.Core/Base/Compiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async Task<CompilationResult> CompileAsync(string compilerName,
3030
stopwatch.Stop();
3131
process.Kill();
3232
result.ErrorMessage = errorOut.ToString();
33-
result.CompilationTime = (ushort) stopwatch.ElapsedMilliseconds;
33+
result.CompilationTime = (ushort)stopwatch.ElapsedMilliseconds;
3434
}
3535
if (File.Exists(compiledFilePath)) result.IsCompiled = true;
3636
else result.IsCompiled = false;

src/CodeStorm.Core/Base/Runner.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ internal class Runner : BaseEngine, IRunner
1818
private Process process = new Process();
1919
private Stopwatch stopwatch = new Stopwatch();
2020

21-
public Runner(string runnerName, string runnerArgs,
21+
public Runner(string runnerName, string runnerArgs,
2222
uint memoryLimit, ushort timeLimit)
2323
{
2424
process.StartInfo = _processInfo;
2525
process.OutputDataReceived += (obj, e) =>
2626
{
27-
if (!string.IsNullOrEmpty(e.Data))
28-
resultStringBuilder.Append(e.Data+"\n");
27+
if (!string.IsNullOrEmpty(e.Data))
28+
resultStringBuilder.Append(e.Data + "\n");
2929
};
3030
process.ErrorDataReceived += (obj, e) =>
3131
{
32-
if (!string.IsNullOrEmpty(e.Data))
33-
errorStringBuilder.Append(e.Data+"\n");
32+
if (!string.IsNullOrEmpty(e.Data))
33+
errorStringBuilder.Append(e.Data + "\n");
3434
};
3535
process.StartInfo.FileName = runnerName;
3636
process.StartInfo.Arguments = runnerArgs;

src/CodeStorm.Core/Base/Tester.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public async Task<TestResult> TestAsync(DirectoryInfo problemSetDirectory)
2424
var result = new TestResult();
2525
IRunner runner = new Runner(runnerName, runnerArgs, memoryLimit, timeLimit);
2626

27-
var testDirs = problemSetDirectory.GetDirectories();
27+
var testDirs = problemSetDirectory.GetDirectories().OrderBy(dir => dir.Name).ToArray();
2828
int totaltestsQuantity = testDirs.Length;
29-
for(ushort i=0; i<totaltestsQuantity; i++)
29+
for (ushort i = 0; i < totaltestsQuantity; i++)
3030
{
3131
string inputPath = Path.Combine(testDirs[i].FullName, NameConstants.INPUT_FILE_NAME);
3232
string input = await File.ReadAllTextAsync(inputPath);
@@ -36,7 +36,7 @@ public async Task<TestResult> TestAsync(DirectoryInfo problemSetDirectory)
3636
var runnerResult = await runner.RunAsync(input);
3737
result.ProcessingTimes.Add(result.AcceptedTestNumber, runnerResult.ExecutionTime);
3838
result.MemoryUsages.Add(result.AcceptedTestNumber, runnerResult.MemoryUsage);
39-
if (!runnerResult.IsSuccessful && String.IsNullOrEmpty(runnerResult.ErrorMessage))
39+
if (!runnerResult.IsSuccessful && !String.IsNullOrEmpty(runnerResult.ErrorMessage))
4040
{
4141
result.ResultType = ResultType.RuntimeError;
4242
result.ErrorMessage = runnerResult.ErrorMessage;
@@ -52,7 +52,7 @@ public async Task<TestResult> TestAsync(DirectoryInfo problemSetDirectory)
5252
result.ResultType = ResultType.MemoryLimitExceeded;
5353
return result;
5454
}
55-
else if (String.IsNullOrEmpty(runnerResult.Result))
55+
else if (String.IsNullOrEmpty(runnerResult.Result) && runnerResult.Result != output)
5656
{
5757
result.ResultType = ResultType.PresentationError;
5858
return result;
@@ -65,10 +65,9 @@ public async Task<TestResult> TestAsync(DirectoryInfo problemSetDirectory)
6565
else
6666
{
6767
result.AcceptedTestNumber++;
68-
6968
}
7069
}
71-
if(result.AcceptedTestNumber == totaltestsQuantity)
70+
if (result.AcceptedTestNumber == totaltestsQuantity)
7271
{
7372
result.ResultType = ResultType.Accepted;
7473
return result;

0 commit comments

Comments
 (0)