Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2001-11-13 04:28:35 +0300
committerMiguel de Icaza <miguel@gnome.org>2001-11-13 04:28:35 +0300
commita97b1f0b2afa19d045cf1ae2162ef59b1c5189cd (patch)
tree4af8d13cdd527633462223fccb52edd560581e3e /mcs/tests/test-42.cs
parent43439c5e47dc1339e409f35ae545b3cd3e6ddf70 (diff)
Add another test
svn path=/trunk/mcs/; revision=1338
Diffstat (limited to 'mcs/tests/test-42.cs')
-rwxr-xr-xmcs/tests/test-42.cs102
1 files changed, 102 insertions, 0 deletions
diff --git a/mcs/tests/test-42.cs b/mcs/tests/test-42.cs
new file mode 100755
index 00000000000..703c0539f18
--- /dev/null
+++ b/mcs/tests/test-42.cs
@@ -0,0 +1,102 @@
+//
+// This has a bunch of different ways of using the mutator
+// operators in C#. Not all of them are yet supported by the
+// compiler. This is here just for references purposes until
+// I am finised and make this into a real test.
+//
+class X {
+
+ int v, p;
+
+ public int this [int n] {
+ get {
+ return v;
+ }
+ set {
+ v = value;
+ }
+ }
+
+ public int P {
+ get {
+ return p;
+ }
+
+ set {
+ p = value;
+ }
+ }
+
+}
+
+class Z {
+ int v;
+
+ public Z P {
+ get {
+ return null;
+ }
+
+ set {
+ }
+ }
+
+ static public Z operator ++ (Z v)
+ {
+ v.v++;
+ return v;
+ }
+}
+
+class Y {
+
+ static int p_pre_increment (X x)
+ {
+ return ++x.P;
+ }
+
+ static int p_post_increment (X x)
+ {
+ return x.P++;
+ }
+
+ static int i_pre_increment (X x)
+ {
+ return ++x [100];
+ }
+
+ static int i_post_increment (X x)
+ {
+ return x [100]++;
+ }
+
+ static Z overload_increment (Z z)
+ {
+ return z++;
+ }
+
+ static Z overload_pre_increment (Z z)
+ {
+ return ++z;
+ }
+
+ static Z ugly (Z z)
+ {
+ return z.P++;
+ }
+
+ static void Main ()
+ {
+ X x = new X ();
+
+ i_pre_increment (x);
+ i_post_increment (x);
+ p_pre_increment (x);
+ p_post_increment (x);
+
+ Z z = new Z();
+
+ overload_increment (z);
+ }
+
+}