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-12-04 03:54:29 +0300
committerMiguel de Icaza <miguel@gnome.org>2001-12-04 03:54:29 +0300
commit9b240f5e20ba55cecf41848bbabd59f8329443c3 (patch)
tree1d35f75aa69536533378b478584664c71db3af82 /mcs/tests/gen-check.cs
parentc736b252ac8f644d27efeb8346fc103689ed5109 (diff)
Add new tests
svn path=/trunk/mcs/; revision=1516
Diffstat (limited to 'mcs/tests/gen-check.cs')
-rwxr-xr-xmcs/tests/gen-check.cs78
1 files changed, 78 insertions, 0 deletions
diff --git a/mcs/tests/gen-check.cs b/mcs/tests/gen-check.cs
new file mode 100755
index 00000000000..9077b141a74
--- /dev/null
+++ b/mcs/tests/gen-check.cs
@@ -0,0 +1,78 @@
+using System;
+
+class Stress {
+
+ static string [] types = {
+ "int", "uint",
+ "short", "ushort",
+ "long", "ulong",
+ "sbyte", "byte", "char"
+ };
+
+
+ static void w (string s)
+ {
+ Console.Write (s);
+ }
+
+ static void wl (string s)
+ {
+ Console.WriteLine (s);
+ }
+
+ static void generate_receptors ()
+ {
+ foreach (string t in types){
+ w ("\tstatic void receive_" + t + " (" + t + " a)\n\t{\n");
+ w ("\t\tConsole.Write (\" \");\n");
+ w ("\t\tConsole.WriteLine (a);\n");
+ w ("\t}\n\n");
+ }
+
+ }
+
+ static void call (string type, string name)
+ {
+ w ("\t\treceive_" + type + " (checked ((" + type + ") var ));\n");
+ }
+
+ static void generate_emision ()
+ {
+ foreach (string type in types){
+ w ("\tstatic void probe_" + type + "()\n\t{\n");
+ if (type == "char")
+ w ("\t\t" + type + " var = (char) 0;");
+ else
+ w ("\t\t" + type + " var = 0;");
+
+ wl ("");
+
+ foreach (string t in types)
+ call (t, "var");
+
+ w ("\t}\n\n");
+ }
+ }
+
+ static void generate_main ()
+ {
+ wl ("\tstatic void Main ()\n\t{");
+
+ foreach (string t in types){
+ w ("\t\tprobe_" + t + " ();\n");
+ }
+ wl ("\t}");
+ }
+
+ static void Main (string [] args)
+ {
+ wl ("using System;\nclass Test {\n");
+
+ generate_receptors ();
+ generate_emision ();
+
+ generate_main ();
+
+ wl ("}\n");
+ }
+}