[interp] Reduce computation under calc_section mutex
[mono-project.git] / mcs / tests / gtest-lambda-06.cs
blob494ca7e9498c313d0b1d50cd06b1834e8619a55d
1 // Inspired by
2 // http://blogs.msdn.com/ericlippert/archive/2007/03/28/lambda-expressions-vs-anonymous-methods-part-five.aspx
4 using System;
6 class TestClass
7 {
8 delegate void DT (T t);
9 delegate void DF (F f);
11 struct T { }
12 struct F { }
14 static void P (DT dt)
16 Console.WriteLine ("True");
17 dt (new T ());
20 static void P (DF df)
22 System.Console.WriteLine ("False");
23 df (new F ());
26 static T And (T a1, T a2) { return new T (); }
27 static F And (T a1, F a2) { return new F (); }
28 static F And (F a1, T a2) { return new F (); }
29 static F And (F a1, F a2) { return new F (); }
31 static T Or (T a1, T a2) { return new T (); }
32 static T Or (T a1, F a2) { return new T (); }
33 static T Or (F a1, T a2) { return new T (); }
34 static F Or (F a1, F a2) { return new F (); }
36 static F Not (T a) { return new F (); }
37 static T Not (F a) { return new T (); }
39 static void StopTrue (T t) { }
41 public static int Main ()
43 // Test that we encode (!v3) & ((!v1) & ((v1 | v2) & (v2 | v3)))
44 P (v1 => P (v2 => P (v3 => StopTrue (
45 And (Not (v3),
46 And (Not (v1),
47 And (Or (v1, v2), Or (v2, v3))
50 ))));
52 return 0;