remove debug writelines
[mcs.git] / tests / test-635.cs
blobe843091b9ab2bacc7b3dd226165752f8912e3269
1 using System;
3 class ShortCircuitFold {
4 static int calls;
5 static bool False { get { ++calls; return false; } }
6 static bool True { get { ++calls; return true; } }
7 static void a (bool e, bool v) { if (e != v) throw new Exception ("unexpected value"); }
8 static void c (int e) { if (e != calls) throw new Exception ("call count mismatch: expected " + e + " but got " + calls); }
9 static bool f () { throw new Exception ("not short circuited out"); }
10 static void Main ()
12 // short circuit out f ()
13 a (false, false && f ());
14 a (true, true || f ());
16 // short circuit out side effects
17 a (false, false && False); c (0);
18 a (true, true || True); c (0);
20 // ensure all side effects occur
21 a (false, true && False); c (1);
22 a (true, false || True); c (2);
24 a (false, false & False); c (3);
25 a (true, true | True); c (4);
27 a (false, true & False); c (5);
28 a (true, false | True); c (6);