Add array copy test.

This commit is contained in:
Charles Betros 2016-11-02 04:36:13 -05:00
parent afdc5a31bf
commit 04ca044e34
3 changed files with 25 additions and 0 deletions

View file

@ -83,6 +83,7 @@
<Compile Include="CSharp\WhileLoopTests.cs" />
<Compile Include="Kernel.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="System\ArrayTests.cs" />
<Compile Include="System\BitConverterTest.cs" />
<Compile Include="System\BooleanTest.cs" />
<Compile Include="System\ByteTest.cs" />

View file

@ -25,6 +25,7 @@ namespace Cosmos.Compiler.Tests.Bcl
CSharp.WhileLoopTests.Execute();
//ObjectTests.Execute(); Stack corruption on method Clone()
ArrayTests.Execute();
StringTest.Execute();
ByteTest.Execute();
SByteTest.Execute();

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cosmos.TestRunner;
namespace Cosmos.Compiler.Tests.Bcl.System
{
class ArrayTests
{
public static void Execute()
{
byte[] xResult = { 1, 2, 3, 4, 5, 6, 7, 8 };
byte[] xExpectedResult = { 1, 2, 3, 4, 5, 6, 7, 1 };
byte[] xSource = { 1 };
Array.Copy(xSource, 0, xResult, 7, 1);
Assert.IsTrue((xResult[7] == xExpectedResult[7]), "Array.Copy doesn't work: xResult[7] " + (uint)xResult[7] + " != " + (uint)xExpectedResult[7]);
}
}
}