diff --git a/Tests/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/ListTest.cs b/Tests/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/ListTest.cs index c3090a0c6..4a3e6294b 100644 --- a/Tests/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/ListTest.cs +++ b/Tests/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/ListTest.cs @@ -38,12 +38,28 @@ namespace Cosmos.Compiler.Tests.Bcl.System.Collections.Generic Assert.AreEqual(1, xList[2], "List.Insert: xList[2] != 1"); Assert.AreEqual(2, xList[3], "List.Insert: xList[3] != 2"); + xList.Insert(0, 7); + + Assert.AreEqual(7, xList[0], "List.Insert: xList[0] != 7"); + Assert.AreEqual(0, xList[1], "List.Insert: xList[1] != 0"); + Assert.AreEqual(5, xList[2], "List.Insert: xList[2] != 5"); + Assert.AreEqual(1, xList[3], "List.Insert: xList[3] != 1"); + Assert.AreEqual(2, xList[4], "List.Insert: xList[4] != 2"); + xList.RemoveAt(2); + Assert.AreEqual(7, xList[0], "List.RemoveAt: xList[0] != 7"); + Assert.AreEqual(0, xList[1], "List.RemoveAt: xList[1] != 0"); + Assert.AreEqual(1, xList[2], "List.RemoveAt: xList[2] != 1"); + Assert.AreEqual(2, xList[3], "List.RemoveAt: xList[3] != 2"); + + xList.RemoveAt(0); + Assert.AreEqual(0, xList[0], "List.RemoveAt: xList[0] != 0"); - Assert.AreEqual(5, xList[1], "List.RemoveAt: xList[1] != 5"); + Assert.AreEqual(1, xList[1], "List.RemoveAt: xList[1] != 1"); Assert.AreEqual(2, xList[2], "List.RemoveAt: xList[2] != 2"); + // Commented tests depend on #583 //xList.AddRange(new List() { 3, 4, 5 }); diff --git a/source/Cosmos.Core_Asm/Array/ArrayInternalCopyAsm.cs b/source/Cosmos.Core_Asm/Array/ArrayInternalCopyAsm.cs index 63a4a0502..bdb52225e 100644 --- a/source/Cosmos.Core_Asm/Array/ArrayInternalCopyAsm.cs +++ b/source/Cosmos.Core_Asm/Array/ArrayInternalCopyAsm.cs @@ -71,22 +71,15 @@ namespace Cosmos.Core_Asm XS.Multiply(EDX); XS.Set(ECX, EAX); - // if source and destination are equal, jump to end - XS.Set(EAX, ESI); - XS.Add(EAX, ECX); - XS.Compare(EDI, EAX); - XS.Jump(ConditionalTestEnum.Equal, xArrayCopyEndLabel); - XS.Jump(ConditionalTestEnum.LessThanOrEqualTo, xArrayCopyReverseLabel); + XS.Compare(EDI, ESI); + XS.Jump(ConditionalTestEnum.GreaterThan, xArrayCopyReverseLabel); new Movs { Size = 8, Prefixes = InstructionPrefixes.Repeat }; XS.Jump(xArrayCopyEndLabel); - // source ptr + size >= destination ptr XS.Label(xArrayCopyReverseLabel); - XS.Comment("Array Reverse Copy: source ptr + size >= destination ptr"); - XS.Add(ESI, ECX); XS.Add(EDI, ECX);