From 5a9a503d3f21d6b32170b6caacc51c0760a19c2f Mon Sep 17 00:00:00 2001 From: Quajak Date: Mon, 7 Sep 2020 00:07:49 +0200 Subject: [PATCH] Added tests to confirm fixes in https://github.com/CosmosOS/IL2CPU/pull/94 --- .../Kernel.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Kernel.cs b/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Kernel.cs index 1497be2b3..6d2955685 100644 --- a/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Kernel.cs +++ b/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Kernel.cs @@ -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();