Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajami1331 committed Sep 28, 2024
1 parent db744f4 commit 3d9ce40
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions IntegrationTest/CompileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,44 @@ public async Task CompileC()
var result = await _sandBoxSerivce.CompileAsync(sourceCode, Guid.NewGuid().ToString(), "c");
Assert.Equal(JudgeStatus.STATUS_ACCEPTED, result.Status);
}

[Fact]
public async Task CompileC11()
{
string sourceCode = "#include <stdio.h>\nint main() { printf(\"Hello, World!\"); return 0; }";
var result = await _sandBoxSerivce.CompileAsync(sourceCode, Guid.NewGuid().ToString(), "c11");
Assert.Equal(JudgeStatus.STATUS_ACCEPTED, result.Status);
}

[Fact]
public async Task CompileCC()
{
string sourceCode = "#include <cstdio>\nint main() { printf(\"Hello, World!\"); return 0; }";
var result = await _sandBoxSerivce.CompileAsync(sourceCode, Guid.NewGuid().ToString(), "cc");
Assert.Equal(JudgeStatus.STATUS_ACCEPTED, result.Status);
}

[Fact]
public async Task CompileCC11()
{
string sourceCode = "#include <cstdio>\nint main() { auto st = \"c++11\"; printf(\"Hello, World!\"); return 0; }";
var result = await _sandBoxSerivce.CompileAsync(sourceCode, Guid.NewGuid().ToString(), "cc11");
Assert.Equal(JudgeStatus.STATUS_ACCEPTED, result.Status);
}

[Fact]
public async Task CompileCC20()
{
string sourceCode = "#include <cstdio>\n#include <compare>\nint main() { int a = 91, b = 110; auto ans1 = a <=> b; printf(\"Hello, World!\"); return 0; }";
var result = await _sandBoxSerivce.CompileAsync(sourceCode, Guid.NewGuid().ToString(), "cc20");
Assert.Equal(JudgeStatus.STATUS_ACCEPTED, result.Status);
}

[Fact]
public async Task CompilePython3()
{
string sourceCode = "print('Hello, World!')";
var result = await _sandBoxSerivce.CompileAsync(sourceCode, Guid.NewGuid().ToString(), "py3");
Assert.Equal(JudgeStatus.STATUS_ACCEPTED, result.Status);
}
}

0 comments on commit 3d9ce40

Please sign in to comment.