[System] Tweak socket test
[mono-project.git] / mono / tests / assignable-tests.cs
blobf1513829a16407825fda7ff07b6c20a0ce6c4996
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 vt_type = typeof (System.ValueType);
16 Type comp_type = typeof (System.IComparable);
17 Type a_type = typeof (A);
18 Type b_type = typeof (B);
19 int error = 1;
21 if (!int_type.IsSubclassOf(vt_type))
22 return error;
23 ++error;
24 if (!int_type.IsSubclassOf(obj_type))
25 return error;
26 ++error;
27 if (int_type.IsSubclassOf(comp_type))
28 return error;
29 ++error;
31 if (int_type.IsAssignableFrom(vt_type))
32 return error;
33 ++error;
34 if (int_type.IsAssignableFrom (obj_type))
35 return error;
36 ++error;
37 if (int_type.IsAssignableFrom(comp_type))
38 return error;
39 ++error;
41 if (!int_type.IsAssignableFrom(int_type))
42 return error;
43 ++error;
44 if (!obj_type.IsAssignableFrom (int_type))
45 return error;
46 ++error;
47 if (!vt_type.IsAssignableFrom(int_type))
48 return error;
49 ++error;
50 if (!comp_type.IsAssignableFrom(int_type))
51 return error;
52 ++error;
54 if (a_type.IsSubclassOf(b_type))
55 return error;
56 ++error;
57 if (b_type.IsAssignableFrom(a_type))
58 return error;
59 ++error;
60 if (b_type.IsSubclassOf(a_type))
61 return error;
62 ++error;
63 if (!a_type.IsAssignableFrom(b_type))
64 return error;
65 ++error;
66 return 0;