class Stress {
+ static string mode = "unchecked";
+
static string [] types = {
"int", "uint",
"short", "ushort",
"long", "ulong",
- "sbyte", "byte",
- "char" };
+ "sbyte", "byte", "char"
+ };
static void w (string s)
static void call (string type, string name)
{
- w ("\t\treceive_" + type + " (unchecked ((" + type + ") " + name + "));\n");
+ w ("\t\treceive_" + type + " (" + mode + "((" + type + ") " + name + "));\n");
}
static void generate_emision ()
wl ("\t\tConsole.WriteLine (\"Testing: " + type + "\");\n");
foreach (string t in types){
- wl ("\t\tConsole.WriteLine (\" arg: " + t + "\");\n");
+ wl ("\t\tConsole.WriteLine (\" arg: " + t + " (" + type + ")\");\n");
call (t, "zero");
call (t, "min");
call (t, "max");
wl ("\t}");
}
- static void Main ()
+ static void Main (string [] args)
{
+ foreach (string arg in args){
+ if (arg == "-h" || arg == "--help"){
+ Console.WriteLine ("-h, --help Shows help");
+ Console.WriteLine ("-c, --checked Generate checked contexts");
+ return;
+ }
+ if (arg == "--checked" || arg == "-c"){
+ mode = "checked";
+ continue;
+ }
+ }
wl ("using System;\nclass Test {\n");
generate_receptors ();