mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
Merge pull request #1472 from CosmosOS/add_branch_tests
Add complex branch tests for compiler
This commit is contained in:
commit
274c5c8b7a
1 changed files with 25 additions and 0 deletions
|
|
@ -12,9 +12,34 @@ namespace Cosmos.Compiler.Tests.MethodTests
|
|||
{
|
||||
Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
|
||||
}
|
||||
public static void BranchStackCorruption2()
|
||||
{
|
||||
char c = 'l';
|
||||
char c2 = (c <= 'Z' && c >= 'A') ? ((char)(c - 65 + 97)) : c;
|
||||
c = 'L';
|
||||
char c3 = (c <= 'Z' && c >= 'A') ? ((char)(c - 65 + 97)) : c;
|
||||
}
|
||||
|
||||
public static void BranchStackCorruption()
|
||||
{
|
||||
bool flag1 = true;
|
||||
bool flag2 = false;
|
||||
bool flag3 = true;
|
||||
|
||||
if (flag1 && (flag2 || flag3))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("This should not occur");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Run()
|
||||
{
|
||||
BranchStackCorruption();
|
||||
BranchStackCorruption2();
|
||||
try
|
||||
{
|
||||
ReturnTests.Execute();
|
||||
|
|
|
|||
Loading…
Reference in a new issue