Update mcs/class/System.Core/System/TimeZoneInfo.cs
[mono.git] / mcs / tests / test-635.cs
1 using System;
2
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 ()
11   {
12     // short circuit out f ()
13     a (false, false && f ());
14     a (true,  true || f ());
15
16     // short circuit out side effects
17     a (false, false && False); c (0);
18     a (true,  true || True);   c (0);
19
20     // ensure all side effects occur
21     a (false, true && False);  c (1);
22     a (true,  false || True);  c (2);
23
24     a (false, false & False);  c (3);
25     a (true,  true | True);    c (4);
26
27     a (false, true & False);   c (5);
28     a (true,  false | True);   c (6);
29   }
30 }