mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
Merge pull request #881 from CosmosOS/callvirt-fixes-tests
Tests for CosmosOS/IL2CPU#39
This commit is contained in:
commit
0e558a79e8
2 changed files with 17 additions and 66 deletions
|
|
@ -15,63 +15,28 @@ namespace BoxingTests
|
||||||
|
|
||||||
protected override void Run()
|
protected override void Run()
|
||||||
{
|
{
|
||||||
Assert.IsTrue(TestBoxingCharToString(), "Boxing char to string test failed.");
|
TestBoxingChar();
|
||||||
Assert.IsTrue(TestBoxingCharArrayToString(), "Boxing char[] to string test failed.");
|
TestBoxingInt();
|
||||||
Assert.IsTrue(TestBoxingIntToString(), "Boxing int to string test failed.");
|
//TestBoxingColorToString();
|
||||||
#if !NETSTANDARD1_5
|
|
||||||
Assert.IsTrue(TestBoxingColorToString(), "Boxing of Color to string test failed.");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TestController.Completed();
|
TestController.Completed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TestBoxingCharToString()
|
private void TestBoxingChar()
|
||||||
{
|
{
|
||||||
try
|
object xChar = 'c';
|
||||||
{
|
|
||||||
char xC = 'c';
|
Assert.IsTrue(xChar.ToString() == "c", "Char.ToString on boxed Char doesn't work!");
|
||||||
string xS = xC.ToString();
|
// 'c' == 0x63, and the hash code is ('c' | ('c' << 16));
|
||||||
return (xS[0] == xC);
|
Assert.IsTrue(xChar.GetHashCode() == 0x00630063, "Char.GetHashCode on boxed Char doesn't work!");
|
||||||
}
|
|
||||||
catch (Exception E)
|
|
||||||
{
|
|
||||||
mDebugger.SendError("TestBoxingCharToString", E.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This test fails with "Object.ToString() not yet implemented" written in the Console */
|
private void TestBoxingInt()
|
||||||
private bool TestBoxingCharArrayToString()
|
|
||||||
{
|
{
|
||||||
try
|
object xNumber = 42;
|
||||||
{
|
|
||||||
char[] xC = { 'c' };
|
|
||||||
string xS = xC.ToString();
|
|
||||||
return (xS[0] == xC[0]);
|
|
||||||
}
|
|
||||||
catch (Exception E)
|
|
||||||
{
|
|
||||||
mDebugger.SendError("TestBoxingCharArrayToString", E.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool TestBoxingIntToString()
|
Assert.IsTrue(xNumber.ToString() == "42", "Int32.ToString on boxed Int32 doesn't work!");
|
||||||
{
|
Assert.IsTrue(xNumber.GetHashCode() == 42, "Int32.GetHashCode on boxed Int32 doesn't work!");
|
||||||
try
|
|
||||||
{
|
|
||||||
object boxMe;
|
|
||||||
int anInt = 42;
|
|
||||||
|
|
||||||
boxMe = anInt;
|
|
||||||
|
|
||||||
return (boxMe.ToString() == "42");
|
|
||||||
}
|
|
||||||
catch (Exception E)
|
|
||||||
{
|
|
||||||
mDebugger.SendError("TestBoxingIntToString", E.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO add other tests:
|
/* TODO add other tests:
|
||||||
|
|
@ -87,24 +52,10 @@ namespace BoxingTests
|
||||||
* Cosmos ignores this and put no padding / writes the struct wrongly in memory and then when it should be
|
* Cosmos ignores this and put no padding / writes the struct wrongly in memory and then when it should be
|
||||||
* boxed garbage is copied instead of the structure itself!
|
* boxed garbage is copied instead of the structure itself!
|
||||||
*/
|
*/
|
||||||
#if !NETSTANDARD1_5
|
private void TestBoxingColorToString()
|
||||||
private bool TestBoxingColorToString()
|
|
||||||
{
|
{
|
||||||
try
|
object xColor = Color.Blue;
|
||||||
{
|
Assert.IsTrue(xColor.ToString() == "Color[Blue]", "Color.ToString doesn't work on boxed Color!");
|
||||||
object boxMe;
|
|
||||||
Color color = Color.Blue;
|
|
||||||
|
|
||||||
boxMe = color;
|
|
||||||
|
|
||||||
return (boxMe.ToString() == "Color[Blue]");
|
|
||||||
}
|
|
||||||
catch (Exception E)
|
|
||||||
{
|
|
||||||
mDebugger.SendError("TestBoxingIntToString", E.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Cosmos.TestRunner.Core
|
||||||
// Stable kernel types: the ones that are stable and will run in AppVeyor
|
// Stable kernel types: the ones that are stable and will run in AppVeyor
|
||||||
public static IEnumerable<Type> GetStableKernelTypes()
|
public static IEnumerable<Type> GetStableKernelTypes()
|
||||||
{
|
{
|
||||||
//yield return typeof(BoxingTests.Kernel);
|
yield return typeof(BoxingTests.Kernel);
|
||||||
yield return typeof(Cosmos.Compiler.Tests.TypeSystem.Kernel);
|
yield return typeof(Cosmos.Compiler.Tests.TypeSystem.Kernel);
|
||||||
yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel);
|
yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel);
|
||||||
//yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
|
//yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue