2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-105.cs
blobfd674725bb8156915e8f12f9518d8fda4577e484
1 namespace A
3 public struct KeyValuePair<X,Y>
5 public KeyValuePair (X x, Y y)
6 { }
9 public interface IComparer<T>
11 int Compare (T x);
14 public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
16 public int Compare (KeyValuePair<K,V> a)
18 return 0;
22 public class TreeBag<T>
24 IComparer<T> comparer;
26 public TreeBag (IComparer<T> comparer)
28 this.comparer = comparer;
31 public int Find (ref T item)
33 return comparer.Compare (item);
37 public class X
39 public static void Test ()
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);
49 namespace B
51 public class KeyValuePair<X,Y>
53 public KeyValuePair (X x, Y y)
54 { }
57 public interface IComparer<T>
59 int Compare (T x);
62 public class KeyValuePairComparer<K,V> : IComparer<KeyValuePair<K,V>>
64 public int Compare (KeyValuePair<K,V> a)
66 return 0;
70 public class TreeBag<T>
72 IComparer<T> comparer;
74 public TreeBag (IComparer<T> comparer)
76 this.comparer = comparer;
79 public int Find (ref T item)
81 return comparer.Compare (item);
85 public class X
87 public static void Test ()
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);
97 class X
99 static void Main ()
101 A.X.Test ();
102 B.X.Test ();