Align libgc vcxproj with makefile.
[mono.git] / mono / tests / valuetype-equals.cs
1 using System;
2
3
4 struct BoolStruct {
5         bool x;
6         public BoolStruct (bool x) { this.x = x; }
7 }
8
9 struct CharStruct {
10         char x;
11         public CharStruct (char x) { this.x = x; }
12 }
13
14 struct Int8Struct {
15         sbyte x;
16         public Int8Struct (sbyte x) { this.x = x; }
17 }
18
19 struct UInt8Struct {
20         byte x;
21         public UInt8Struct (byte x) { this.x = x; }
22 }
23
24 struct Int16Struct {
25         short x;
26         public Int16Struct (short x) { this.x = x; }
27 }
28
29 struct UInt16Struct {
30         ushort x;
31         public UInt16Struct (ushort x) { this.x = x; }
32 }
33
34 struct Int32Struct {
35         int x;
36         public Int32Struct (int x) { this.x = x; }
37 }
38
39 struct UInt32Struct {
40         uint x;
41         public UInt32Struct (uint x) { this.x = x; }
42 }
43
44 struct Int64Struct {
45         long x;
46         public Int64Struct (long x) { this.x = x; }
47 }
48
49 struct UInt64Struct {
50         ulong x;
51         public UInt64Struct (ulong x) { this.x = x; }
52 }
53
54 struct FloatStruct {
55         float x;
56         public FloatStruct (float x) { this.x = x; }
57 }
58
59 struct DoubleStruct {
60         double x;
61         public DoubleStruct (double x) { this.x = x; }
62 }
63
64
65 public class Driver {
66         static void AssertEqual (object a, object b) {
67                 if (!a.Equals (b))
68                         throw new Exception (String.Format ("must be equal {0} {1}", a, b));
69         }
70
71         static void AssertNotEqual (object a, object b) {
72                 if (a.Equals (b))
73                         throw new Exception (String.Format ("must not be equal {0} {1}", a, b));
74         }
75
76         public static int Main () {
77                 AssertEqual (new BoolStruct (true), new BoolStruct (true));
78                 AssertNotEqual (new BoolStruct (false), new BoolStruct (true));
79
80                 AssertEqual (new CharStruct ('c'), new CharStruct ('c'));
81                 AssertNotEqual (new CharStruct ('d'), new CharStruct ('c'));
82
83                 AssertEqual (new Int8Struct (13), new Int8Struct (13));
84                 AssertEqual (new Int8Struct (0), new Int8Struct (0));
85                 AssertNotEqual (new Int8Struct (44), new Int8Struct (1));
86                 AssertNotEqual (new Int8Struct (0), new Int8Struct (55));
87
88                 AssertEqual (new UInt8Struct (13), new UInt8Struct (13));
89                 AssertEqual (new UInt8Struct (0), new UInt8Struct (0));
90                 AssertNotEqual (new UInt8Struct (44), new UInt8Struct (1));
91                 AssertNotEqual (new UInt8Struct (0), new UInt8Struct (55));
92
93                 AssertEqual (new Int16Struct (13), new Int16Struct (13));
94                 AssertEqual (new Int16Struct (0), new Int16Struct (0));
95                 AssertNotEqual (new Int16Struct (44), new Int16Struct (1));
96                 AssertNotEqual (new Int16Struct (0), new Int16Struct (55));
97
98                 AssertEqual (new UInt16Struct (13), new UInt16Struct (13));
99                 AssertEqual (new UInt16Struct (0), new UInt16Struct (0));
100                 AssertNotEqual (new UInt16Struct (44), new UInt16Struct (1));
101                 AssertNotEqual (new UInt16Struct (0), new UInt16Struct (55));
102
103                 AssertEqual (new Int32Struct (13), new Int32Struct (13));
104                 AssertEqual (new Int32Struct (0), new Int32Struct (0));
105                 AssertNotEqual (new Int32Struct (44), new Int32Struct (1));
106                 AssertNotEqual (new Int32Struct (0), new Int32Struct (55));
107
108                 AssertEqual (new UInt32Struct (13), new UInt32Struct (13));
109                 AssertEqual (new UInt32Struct (0), new UInt32Struct (0));
110                 AssertNotEqual (new UInt32Struct (44), new UInt32Struct (1));
111                 AssertNotEqual (new UInt32Struct (0), new UInt32Struct (55));
112
113                 AssertEqual (new Int64Struct (13), new Int64Struct (13));
114                 AssertEqual (new Int64Struct (0), new Int64Struct (0));
115                 AssertNotEqual (new Int64Struct (44), new Int64Struct (1));
116                 AssertNotEqual (new Int64Struct (0), new Int64Struct (55));
117
118                 AssertEqual (new UInt64Struct (13), new UInt64Struct (13));
119                 AssertEqual (new UInt64Struct (0), new UInt64Struct (0));
120                 AssertNotEqual (new UInt64Struct (44), new UInt64Struct (1));
121                 AssertNotEqual (new UInt64Struct (0), new UInt64Struct (55));
122
123                 AssertEqual (new FloatStruct (13), new FloatStruct (13));
124                 AssertEqual (new FloatStruct (0), new FloatStruct (0));
125                 AssertNotEqual (new FloatStruct (44), new FloatStruct (1));
126                 AssertNotEqual (new FloatStruct (0), new FloatStruct (55));
127
128                 AssertEqual (new DoubleStruct (13), new DoubleStruct (13));
129                 AssertEqual (new DoubleStruct (0), new DoubleStruct (0));
130                 AssertNotEqual (new DoubleStruct (44), new DoubleStruct (1));
131                 AssertNotEqual (new DoubleStruct (0), new DoubleStruct (55));
132
133                 return 0;
134         }
135 }