Skip to content

Commit

Permalink
Update wrong string test
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Feb 8, 2022
1 parent c9a29e6 commit d5f404e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public static unsafe void Execute()

char[] charArray = { 'h', 'e', 'l', 'l', 'o', '\u0000' };
string aString = new string(charArray);
Assert.AreEqual("hello\u0000", aString, "String can be created from char array");
Assert.AreEqual(6, aString.Length, "Length of string from char array is correct");
Assert.AreEqual("hello", aString, "String can be created from char array");
Assert.AreEqual(5, aString.Length, "Length of string from char array is correct");

fixed (char* ptr = charArray)
{
Expand Down Expand Up @@ -225,8 +225,8 @@ public static unsafe void Execute()

// we test if the strigns allocted at the beginning are still correct to ensure that the memory they were allocated in was not incorrectly overwritten
// we need to test all of the ctors since we have custom code in the NewObj.cs to calculate the correct length for the string to be allocated
Assert.AreEqual("hello", aString, "aString is still correct");
Assert.AreEqual("hello", spanString, "spanString is still correct");
Assert.AreEqual("hell", aString, "aString is still correct");
Assert.AreEqual("hell", spanString, "spanString is still correct");
}
}
}

0 comments on commit d5f404e

Please sign in to comment.