diff options
Diffstat (limited to 'tests/src/JIT/Regression/JitBlue/GitHub_11508/GitHub_11508.cs')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_11508/GitHub_11508.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_11508/GitHub_11508.cs b/tests/src/JIT/Regression/JitBlue/GitHub_11508/GitHub_11508.cs new file mode 100644 index 0000000000..11081ba9ae --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_11508/GitHub_11508.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace TestApp +{ + public struct StructWithValue : IEquatable<StructWithValue> + { + private ushort value; + + public StructWithValue(ushort v) + { + value = v; + } + + + public bool Equals(StructWithValue other) + { + if (value.Equals (other.value)) + return true; + else + return false; + } + } + + class Program + { + [MethodImpl(MethodImplOptions.NoOptimization)] + static int Main(string[] args) + { + var comparer = EqualityComparer<StructWithValue>.Default; + + for (ushort i = 0; ; i++) + { + var a = new StructWithValue(i); + var b = new StructWithValue(i); + + if (!comparer.Equals(a, b)) + { + return 0; + } + + if (i == ushort.MaxValue) + { + break; + } + } + + return 100; + } + } +} |