Cosmos/source/Boot/TestSuite/Tests/MathTest.cs
LostTheBlack_cp 72092fc41d [+] Fixed issue #4054 (Switch-Case causes InvalidOperationException).
[*] All conditional branch instructions on longs marked NotImplemented.
[!] Someone familiar enough should review compiler's comparisons handling.
2008-03-18 13:32:24 +00:00

50 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace TestSuite.Tests
{
public class MathTest : TestBase
{
public override string Name
{
get { return "Math"; }
}
public override void Initialize()
{
}
public override void Teardown()
{
}
public override void Test()
{
Assert(1 + 1 == 2, "1 + 1 == 2");
Assert(-1 + 2 == 1, "-1 + 2 == 1");
Assert(2 * 2 == 4, "2 * 2 == 4");
Assert(6 / 2 == 3, "6 / 2 == 3");
Assert(5 - 2 == 3, "5 - 2 == 3");
Assert(-1 < 1, "-1 < 1");
Assert(0xFFFFFFFFu > 1u, "0xFFFFFFFFu > 1u");
Assert(2 + 5 * 2 == 12, "2 + 5 * 2 == 12");
Assert((2 + 5) * 2 == 14, "(2 + 5) * 2 == 14");
long al = 0x1FFFFFFFF;
long bl = 0x300000000; //1L;
al += 0x01; //al == 0x200000000
bl -= 0xFFFFFFFFL; //bl == 0x200000001
al -= 0x02; //al == 0x1FFFFFFFE
bl -= 0x03; //bl == 0x1FFFFFFFE
Assert(al == bl, "Int64 operations");
Assert((-41) - (-31) == -10, "Int64 negatives");
UInt32 a = 5;
UInt32 b = 5;
Assert(a == b, "UInt32 Equality");
b = 10;
Assert(a != b, "UInt32 Inequality");
}
}
}