diff options
author | Jan Kotas <jkotas@microsoft.com> | 2016-03-08 10:13:11 -0800 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-03-08 10:13:11 -0800 |
commit | 326dee799c2a63cbe841054dc1eaaec483d85250 (patch) | |
tree | eb97f7d46f2ebf1f80d69ad53b2f25f2aa5c0527 /tests | |
parent | 56c43a5b229c375b5e11eba25dc0ab5997f23256 (diff) | |
parent | a1b04ccba4daed1378a157cace16a50ecf998a0b (diff) | |
download | coreclr-326dee799c2a63cbe841054dc1eaaec483d85250.tar.gz coreclr-326dee799c2a63cbe841054dc1eaaec483d85250.tar.bz2 coreclr-326dee799c2a63cbe841054dc1eaaec483d85250.zip |
Merge pull request #3573 from vcsjones/fix-3566
Fix failing test in IntPtrGetHashCode.
Diffstat (limited to 'tests')
-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; } } |