Fix TPA map hash calculation. (#288)
[platform/upstream/coreclr.git] / src / coreclr / tests / src / Loader / binding / assemblies / assemblybugs / 37910 / Ii.cs
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 using System;
5 using System.Reflection;
6 using System.Runtime.InteropServices;
7
8 public class Program
9 {
10     [DllImport("libc", EntryPoint = "setlocale")]
11     public static extern IntPtr setlocale(int category, [MarshalAs(UnmanagedType.LPStr)] string locale);
12
13     public static int Main()
14     {
15         Assembly a1 = Assembly.GetExecutingAssembly();
16
17         // In case of Turkish locale:
18         // towupper 'i' -> \x0130 (instead of 'I')
19         // towlower 'I' -> \x0131 (instead of 'i')
20         const string TRLocale = "tr_TR.UTF-8";
21         IntPtr res = setlocale(6 /*LC_ALL*/, TRLocale);
22         if (TRLocale != Marshal.PtrToStringAnsi(res))
23         {
24             Console.WriteLine("Failed! " + TRLocale + " locale was not found in system!");
25             return -1;
26         }
27
28         Assembly a2 = Assembly.Load("Ii");
29
30         if (a1 != a2)
31         {
32             Console.WriteLine("Failed!");
33             return -2;
34         }
35
36         Console.WriteLine("Passed!");
37         return 100;
38     }
39 }