* StringTest.cs: Added test for Concat when one of the arguments is an
[mono.git] / mono / tests / delegate4.cs
1 using System;
2 using System.Threading;
3 using System.Runtime.InteropServices;
4 using System.Runtime.Remoting.Messaging;
5
6 class Test {
7         public delegate int SimpleDelegate (int a, int b);
8
9         [DllImport ("libtest", EntryPoint="mono_invoke_delegate")]
10         static extern int mono_invoke_delegate (SimpleDelegate d);
11
12         public static int Add (int a, int b) {
13                 Console.WriteLine ("Test.Add from delegate: " + a +  " + " + b);
14                 return a + b;
15         }
16
17         public static int Add2 (int a, int b) {
18                 Console.WriteLine ("Test.Add2 from delegate: " + a +  " + " + b);
19                 return a + b;
20         }
21
22         static int Main () {
23                 SimpleDelegate d = new SimpleDelegate (Add);
24                 SimpleDelegate d2 = new SimpleDelegate (Add2);
25                 
26                 if (mono_invoke_delegate (d) != 5)
27                         return 1;
28
29                 if (mono_invoke_delegate (d2) != 5)
30                         return 1;
31
32                 return 0;
33         }
34 }