diff options
author | Kevin Jones <kevin@vcsjones.com> | 2016-03-07 18:16:03 -0500 |
---|---|---|
committer | Kevin Jones <kevin@vcsjones.com> | 2016-03-07 20:29:29 -0500 |
commit | a1b04ccba4daed1378a157cace16a50ecf998a0b (patch) | |
tree | 62dd234e6c74fa3a2060325d1b822e0f97e81554 /tests/src/CoreMangLib | |
parent | 8e069ce739232b43085e530556bf6b02832d8b5b (diff) | |
download | coreclr-a1b04ccba4daed1378a157cace16a50ecf998a0b.tar.gz coreclr-a1b04ccba4daed1378a157cace16a50ecf998a0b.tar.bz2 coreclr-a1b04ccba4daed1378a157cace16a50ecf998a0b.zip |
Fix failing test in IntPtrGetHashCode.
Test was not updated to reflect changes in GetHashCode.
Fix #3566
Diffstat (limited to 'tests/src/CoreMangLib')
-rw-r--r-- | tests/src/CoreMangLib/cti/system/intptr/intptrgethashcode.cs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/src/CoreMangLib/cti/system/intptr/intptrgethashcode.cs b/tests/src/CoreMangLib/cti/system/intptr/intptrgethashcode.cs index 5f85489d40..ffc46c7d58 100644 --- a/tests/src/CoreMangLib/cti/system/intptr/intptrgethashcode.cs +++ b/tests/src/CoreMangLib/cti/system/intptr/intptrgethashcode.cs @@ -67,9 +67,25 @@ public class IntPtrGetHashCode { byte* mem = stackalloc byte[1024]; System.IntPtr ip = new IntPtr((void*)mem); - if (ip.GetHashCode() != (int)mem) + if (System.IntPtr.Size == 4) + { + if (ip.GetHashCode() != (int)mem) + { + TestLibrary.TestFramework.LogError("002", "expect IntPtr.GetHashCode() equals the address"); + retVal = false; + } + } + else if (System.IntPtr.Size == 8) + { + if (ip.GetHashCode() != ((int)mem ^ (int)((long)mem >> 32))) + { + TestLibrary.TestFramework.LogError("002", "expect IntPtr.GetHashCode() equals the address xor halves"); + retVal = false; + } + } + else { - TestLibrary.TestFramework.LogError("002", "expect IntPtr.GetHashCode() equals the address"); + TestLibrary.TestFramework.LogError("002", "Unexpected IntPtr.Size: " + System.IntPtr.Size); retVal = false; } } |