Update Haiku support (#15674)
[mono-project.git] / mono / tests / assignable-tests.cs
blob91f15ddc05a0a0d813657f94670e3a5cb0751818
2 using System;
4 namespace Test {
5 public interface A {
6 void method ();
8 public interface B : A {
9 void method2 ();
11 public class test {
12 public static int Main () {
13 Type int_type = typeof (int);
14 Type obj_type = typeof (object);
15 Type obj_arr_type = typeof (object[]);
16 Type vt_type = typeof (System.ValueType);
17 Type comp_type = typeof (System.IComparable);
18 Type a_type = typeof (A);
19 Type b_type = typeof (B);
20 Type ptr_type = typeof (int*);
21 Type ptr_arr_type = typeof (int*[]);
22 int error = 1;
24 if (!int_type.IsSubclassOf(vt_type))
25 return error;
26 ++error;
27 if (!int_type.IsSubclassOf(obj_type))
28 return error;
29 ++error;
30 if (int_type.IsSubclassOf(comp_type))
31 return error;
32 ++error;
34 if (int_type.IsAssignableFrom(vt_type))
35 return error;
36 ++error;
37 if (int_type.IsAssignableFrom (obj_type))
38 return error;
39 ++error;
40 if (int_type.IsAssignableFrom(comp_type))
41 return error;
42 ++error;
44 if (!int_type.IsAssignableFrom(int_type))
45 return error;
46 ++error;
47 if (!obj_type.IsAssignableFrom (int_type))
48 return error;
49 ++error;
50 if (!vt_type.IsAssignableFrom(int_type))
51 return error;
52 ++error;
53 if (!comp_type.IsAssignableFrom(int_type))
54 return error;
55 ++error;
57 if (a_type.IsSubclassOf(b_type))
58 return error;
59 ++error;
60 if (b_type.IsAssignableFrom(a_type))
61 return error;
62 ++error;
63 if (b_type.IsSubclassOf(a_type))
64 return error;
65 ++error;
66 if (!a_type.IsAssignableFrom(b_type))
67 return error;
68 ++error;
70 if (obj_type.IsAssignableFrom(ptr_type))
71 return error;
72 ++error;
73 if (ptr_type.IsAssignableFrom(obj_type))
74 return error;
75 ++error;
76 if (obj_arr_type.IsAssignableFrom(ptr_arr_type))
77 return error;
78 ++error;
79 if (ptr_arr_type.IsAssignableFrom(obj_arr_type))
80 return error;
81 ++error;
82 return 0;