Add more test coverage for dotnet/coreclrdotnet/corefx#6119 (dotnet/corefx#9844)
authorJames Ko <jamesqko@gmail.com>
Wed, 6 Jul 2016 03:48:58 +0000 (23:48 -0400)
committerStephen Toub <stoub@microsoft.com>
Wed, 6 Jul 2016 03:48:58 +0000 (23:48 -0400)
* Add more test coverage for dotnet/coreclrdotnet/corefx#6119

Commit migrated from https://github.com/dotnet/corefx/commit/860d28cbb752a7a5ccd191b6f784c4f4d15909e2

src/libraries/System.Runtime/tests/System/StringTests.cs

index a2785bd..e1e9b9b 100644 (file)
@@ -482,6 +482,15 @@ namespace System.Tests
         [InlineData("aaaaaaaaaaaaaa", 1, "aaaxaaaaaaaaaa", 3, 100, StringComparison.Ordinal, -1)]     // Different long alignment, abs of 4, one of them is 2, different at n=1
         [InlineData("-aaaaaaaaaaaaa", 1, "++++aaaaaaaaaa", 4, 10, StringComparison.Ordinal, 0)]       // Different long alignment, equal compare
         [InlineData("aaaaaaaaaaaaaa", 1, "aaaaaaaaaaaaax", 4, 100, StringComparison.Ordinal, -1)]     // Different long alignment
+        [InlineData("\0", 0, "", 0, 1, StringComparison.Ordinal, 1)]                                  // Same memory layout, except for m_stringLength (m_firstChars are both 0)
+        [InlineData("\0\0", 0, "", 0, 2, StringComparison.Ordinal, 1)]                                // Same as above, except m_stringLength for one is 2
+        [InlineData("", 0, "\0b", 0, 2, StringComparison.Ordinal, -1)]                                // strA's second char != strB's second char codepath
+        [InlineData("", 0, "b", 0, 1, StringComparison.Ordinal, -1)]                                  // Should hit strA.m_firstChar != strB.m_firstChar codepath
+        [InlineData("abcxxxxxxxxxxxxxxxxxxxxxx", 0, "abdxxxxxxxxxxxxxxx", 0, int.MaxValue, StringComparison.Ordinal, -1)] // 64-bit: first long compare is different
+        [InlineData("abcdefgxxxxxxxxxxxxxxxxxx", 0, "abcdefhxxxxxxxxxxx", 0, int.MaxValue, StringComparison.Ordinal, -1)] // 64-bit: second long compare is different
+        [InlineData("abcdefghijkxxxxxxxxxxxxxx", 0, "abcdefghijlxxxxxxx", 0, int.MaxValue, StringComparison.Ordinal, -1)] // 64-bit: third long compare is different
+        [InlineData("abcdexxxxxxxxxxxxxxxxxxxx", 0, "abcdfxxxxxxxxxxxxx", 0, int.MaxValue, StringComparison.Ordinal, -1)] // 32-bit: second int compare is different
+        [InlineData("abcdefghixxxxxxxxxxxxxxxx", 0, "abcdefghjxxxxxxxxx", 0, int.MaxValue, StringComparison.Ordinal, -1)] // 32-bit: fourth int compare is different
         [InlineData(null, 0, null, 0, 0, StringComparison.Ordinal, 0)]
         [InlineData("Hello", 0, null, 0, 5, StringComparison.Ordinal, 1)]
         [InlineData(null, 0, "Hello", 0, 5, StringComparison.Ordinal, -1)]