Merge pull request #4195 from lateralusX/jlorenss/win-build-dependency
[mono.git] / mcs / tests / gtest-105.cs
1 namespace A
2 {
3         public struct KeyValuePair<X,Y>
4         {
5                 public KeyValuePair (X x, Y y)
6                 { }
7         }
8
9         public interface IComparer<T>
10         {
11                 int Compare (T x);
12         }
13
14         public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
15         {
16                 public int Compare (KeyValuePair<K,V> a)
17                 {
18                         return 0;
19                 }
20         }
21
22         public class TreeBag<T>
23         {
24                 IComparer<T> comparer;
25
26                 public TreeBag (IComparer<T> comparer)
27                 {
28                         this.comparer = comparer;
29                 }
30
31                 public int Find (ref T item)
32                 {
33                         return comparer.Compare (item);
34                 }
35         }
36
37         public class X
38         {
39                 public static void Test ()
40                 {
41                         KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
42                         KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
43                         TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer);
44                         bag.Find (ref pair);
45                 }
46         }
47 }
48
49 namespace B
50 {
51         public class KeyValuePair<X,Y>
52         {
53                 public KeyValuePair (X x, Y y)
54                 { }
55         }
56
57         public interface IComparer<T>
58         {
59                 int Compare (T x);
60         }
61
62         public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
63         {
64                 public int Compare (KeyValuePair<K,V> a)
65                 {
66                         return 0;
67                 }
68         }
69
70         public class TreeBag<T>
71         {
72                 IComparer<T> comparer;
73
74                 public TreeBag (IComparer<T> comparer)
75                 {
76                         this.comparer = comparer;
77                 }
78
79                 public int Find (ref T item)
80                 {
81                         return comparer.Compare (item);
82                 }
83         }
84
85         public class X
86         {
87                 public static void Test ()
88                 {
89                         KeyValuePair<int,int> pair = new KeyValuePair<int,int> (3, 89);
90                         KeyValuePairComparer<int,int> comparer = new KeyValuePairComparer<int,int> ();
91                         TreeBag<KeyValuePair<int,int>> bag = new TreeBag<KeyValuePair<int,int>> (comparer);
92                         bag.Find (ref pair);
93                 }
94         }
95 }
96
97 class X
98 {
99         public static void Main ()
100         {
101                 A.X.Test ();
102                 B.X.Test ();
103         }
104 }