using System; using System.Collections.Generic; using System.Text; using Cosmos.Kernel; namespace TestSuite { /// /// Represents a simple test case for the kernel/il2cpu. /// public abstract class TestBase { /// /// Gets the name of the test caes. /// public abstract string Name { get; } /// /// Prepares the test case for use. /// public abstract void Initialize(); /// /// Stops the test case. /// public abstract void Teardown(); /// /// Runs the test case. /// public abstract void Test(); /// /// Makes sure a certain condition is true. /// protected bool Assert(bool condition, string message) { if (!condition) { System.Console.ForegroundColor = ConsoleColor.Red; System.Console.Write("TEST FAILED: "); System.Console.ForegroundColor = ConsoleColor.White; System.Console.WriteLine(message); } else { System.Console.ForegroundColor = ConsoleColor.Green; System.Console.Write("TEST SUCCEEDED: "); System.Console.ForegroundColor = ConsoleColor.White; System.Console.WriteLine(message); } DebugUtil.SendTestAssert(condition, message); return condition; } /// /// Makes sure a certain condition is false. /// /// /// /// protected bool AssertFalse(bool condition, string message) { return !Assert(!condition, message); } } }