Cosmos/Tests/Kernels/Cosmos.Compiler.Tests.Bcl.System/System/StandardMethodTest.cs
2020-11-23 22:16:01 +01:00

35 lines
949 B
C#

using Cosmos.TestRunner;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cosmos.Compiler.Tests.Bcl.System
{
static class StandardMethodTest
{
static class HexConverter
{
public static char ToCharUpper(int value)
{
value &= 0xF;
value += 48;
if (value > 57)
{
value += 7;
}
return (char)value;
}
}
public static void Execute()
{
char[] numbers = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
for (int i = 0; i < 16; i++)
{
Assert.AreEqual(numbers[i], HexConverter.ToCharUpper(i), "ToCharUpper works: " + HexConverter.ToCharUpper(i));
}
}
}
}