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-06 19:17:02 +0300
committerMiguel de Icaza <miguel@gnome.org>2001-11-06 19:17:02 +0300
commit724cc456ac1010ff8236ca8e1f43c6ea63b21d34 (patch)
treeee571304d57d1684583afd559c3e47602dad70fd /mcs/tests/test-35.cs
parentf8112272d9223891a8669202a548c27fecebb5c0 (diff)
Add test for !bool optimization; Make linux build the only one
svn path=/trunk/mcs/; revision=1275
Diffstat (limited to 'mcs/tests/test-35.cs')
-rwxr-xr-xmcs/tests/test-35.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/mcs/tests/test-35.cs b/mcs/tests/test-35.cs
new file mode 100755
index 00000000000..15654965b24
--- /dev/null
+++ b/mcs/tests/test-35.cs
@@ -0,0 +1,61 @@
+//
+// This test checks the !x optimization for if/while/for/do
+//
+class X {
+
+ static bool t = true;
+ static bool f = false;
+ static int j = 0;
+
+ static void a ()
+ {
+ if (!t)
+ j = 1;
+ }
+
+ static int Main ()
+ {
+ int ok = 0, error = 0;
+
+ if (!f)
+ ok = 1;
+ else
+ error++;
+
+ if (f)
+ error++;
+ else
+ ok |= 2;
+
+ if (t)
+ ok |= 4;
+ else
+ error++;
+
+ if (!t)
+ error++;
+ else
+ ok |= 8;
+
+ if (!(t && f == false))
+ error++;
+ else
+ ok |= 16;
+
+ int i = 0;
+ do {
+ i++;
+ } while (!(i > 5));
+ if (i != 6)
+ error ++;
+ else
+ ok |= 32;
+
+ do {
+ i++;
+ } while (!t);
+
+ System.Console.WriteLine ("Ok=" + ok + " Errors=" + error);
+ return ((ok == 63) && (error == 0)) ? 0 : 1;
+ }
+}