[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / gen-check.cs
blobc68fc71ab62ba2bd206a3c567218dafc4b869ef5
1 using System;
3 class Stress {
5 static string [] types = {
6 "int", "uint",
7 "short", "ushort",
8 "long", "ulong",
9 "sbyte", "byte", "char"
13 static void w (string s)
15 Console.Write (s);
18 static void wl (string s)
20 Console.WriteLine (s);
23 static void generate_receptors ()
25 foreach (string t in types){
26 w ("\tstatic void receive_" + t + " (" + t + " a)\n\t{\n");
27 w ("\t\tConsole.Write (\" \");\n");
28 w ("\t\tConsole.WriteLine (a);\n");
29 w ("\t}\n\n");
34 static void call (string type, string name)
36 w ("\t\treceive_" + type + " (checked ((" + type + ") var ));\n");
39 static void generate_emision ()
41 foreach (string type in types){
42 w ("\tstatic void probe_" + type + "()\n\t{\n");
43 if (type == "char")
44 w ("\t\t" + type + " var = (char) 0;");
45 else
46 w ("\t\t" + type + " var = 0;");
48 wl ("");
50 foreach (string t in types)
51 call (t, "var");
53 w ("\t}\n\n");
57 static void generate_main ()
59 wl ("\tpublic static void Main ()\n\t{");
61 foreach (string t in types){
62 w ("\t\tprobe_" + t + " ();\n");
64 wl ("\t}");
67 public static void Main (string [] args)
69 wl ("using System;\nclass Test {\n");
71 generate_receptors ();
72 generate_emision ();
74 generate_main ();
76 wl ("}\n");