diff --git a/Tests/Cosmos.Compiler.Tests.Bcl/Kernel.cs b/Tests/Cosmos.Compiler.Tests.Bcl/Kernel.cs index 8bb114a448..11509f711e 100644 --- a/Tests/Cosmos.Compiler.Tests.Bcl/Kernel.cs +++ b/Tests/Cosmos.Compiler.Tests.Bcl/Kernel.cs @@ -45,6 +45,7 @@ protected override void Run() SingleTest.Execute(); DoubleTest.Execute(); MathTest.Execute(); + ConvertTests.Execute(); //mDebugger.Send("Thread test start of 500 ms"); //ThreadTest.Execute(); diff --git a/Tests/Cosmos.Compiler.Tests.Bcl/System/ConvertTests.cs b/Tests/Cosmos.Compiler.Tests.Bcl/System/ConvertTests.cs new file mode 100644 index 0000000000..656c30f79b --- /dev/null +++ b/Tests/Cosmos.Compiler.Tests.Bcl/System/ConvertTests.cs @@ -0,0 +1,29 @@ +using System; + +using Cosmos.TestRunner; + +namespace Cosmos.Compiler.Tests.Bcl.System +{ + internal static class ConvertTests + { + public static void Execute() + { + var number = 5; + var numberToString = Convert.ToString(number); + + Assert.IsTrue(numberToString == "5", $"Convert.ToString(Int32) doesn't work. Result: {numberToString}"); + + var numberToByte = Convert.ToByte(number); + + Assert.IsTrue(numberToByte == 5, $"Convert.ToByte(Int32) doesn't work. Result: {numberToByte}"); + + var byteToSingle = Convert.ToSingle(numberToByte); + + Assert.IsTrue(EqualityHelper.SinglesAreEqual(byteToSingle, 5.0f), $"Convert.ToSingle(Byte) doesn't work. Result: {byteToSingle}"); + + var numberToBase64 = Convert.ToBase64String(BitConverter.GetBytes(number)); + + Assert.IsTrue(numberToBase64 == "BQAAAA==", $"Convert.ToBase64String(byte[]) doesn't work. Result: {numberToBase64}"); + } + } +} diff --git a/source/Archive/Old System Plugs/DecimalImpl.cs b/source/Cosmos.System2_Plugs/System/DecimalImpl.cs similarity index 70% rename from source/Archive/Old System Plugs/DecimalImpl.cs rename to source/Cosmos.System2_Plugs/System/DecimalImpl.cs index 434744b466..9b452bed6b 100644 --- a/source/Archive/Old System Plugs/DecimalImpl.cs +++ b/source/Cosmos.System2_Plugs/System/DecimalImpl.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Cosmos.IL2CPU.Plugs; +using IL2CPU.API.Attribs; -namespace Cosmos.System.Plugs.System +namespace Cosmos.System_Plugs.System { [Plug(Target = typeof(decimal))] public static class DecimalImpl diff --git a/source/Cosmos.System2_Plugs/System/Int32Impl.cs b/source/Cosmos.System2_Plugs/System/Int32Impl.cs index 76d8555151..be131cba90 100644 --- a/source/Cosmos.System2_Plugs/System/Int32Impl.cs +++ b/source/Cosmos.System2_Plugs/System/Int32Impl.cs @@ -1,7 +1,5 @@ using System; using Cosmos.Common; -using Cosmos.Debug.Kernel; -using IL2CPU.API; using IL2CPU.API.Attribs; namespace Cosmos.System_Plugs.System @@ -14,6 +12,8 @@ public static string ToString(ref int aThis) return StringHelper.GetNumberString(aThis); } + public static string ToString(ref int aThis, IFormatProvider aFormatProvider) => ToString(ref aThis); + public static Int32 Parse(string s) { const string digits = "0123456789";