summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-03-08 10:13:11 -0800
committerJan Kotas <jkotas@microsoft.com>2016-03-08 10:13:11 -0800
commit326dee799c2a63cbe841054dc1eaaec483d85250 (patch)
treeeb97f7d46f2ebf1f80d69ad53b2f25f2aa5c0527 /tests
parent56c43a5b229c375b5e11eba25dc0ab5997f23256 (diff)
parenta1b04ccba4daed1378a157cace16a50ecf998a0b (diff)
downloadcoreclr-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.cs20
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;
}
}