Esempio n. 1
0
 public void consumeTestFlag()
 {
     ArgDef testDef = new ArgDef();
     testDef.argLabels.Add("-t");
     testDef.parseInit(ArgTypeParser.basicParsers);
     VirtualArray<string> vArgs = new VirtualArray<string>(new string[] { "-t" });
     ParsedArgs pArgs = new ParsedArgs();
     testDef.consume(vArgs, pArgs);
     Assert.IsTrue(pArgs.containsKey("t"), "[ArgDef][consume] consume should add a value to the passed in ParsedArgs when the appropriate args are given");
     Assert.IsTrue(pArgs.getValue<bool>("t"), "[ArgDef][consume] consume should set the appropriate value for the given arg name when encountered.");
 }
Esempio n. 2
0
 public void consumeTestLabeledDouble()
 {
     ArgDef testDef = new ArgDef();
     testDef.argLabels.Add("-t");
     testDef.type = typeof(double);
     testDef.argCount = 1;
     testDef.parseInit(ArgTypeParser.basicParsers);
     VirtualArray<string> vArgs = new VirtualArray<string>(new string[] { "-t", "33.3" });
     ParsedArgs pArgs = new ParsedArgs();
     testDef.consume(vArgs, pArgs);
     Assert.IsTrue(pArgs.containsKey("t"), "[ArgDef][consume] consume should add a value to the passed in ParsedArgs when the appropriate args are given");
     Assert.AreEqual(33.3, pArgs.getValue<double>("t"), 0.01, "[ArgDef][consume] consume should add a value to the passed in ParsedArgs when the appropriate args are given");
 }
Esempio n. 3
0
 public void consumeTestOrderedInt()
 {
     ArgDef testDef = new ArgDef();
     testDef.name = "test";
     testDef.type = typeof(int);
     testDef.parseInit(ArgTypeParser.basicParsers);
     VirtualArray<string> vArgs = new VirtualArray<string>(new string[] { "33" });
     ParsedArgs pArgs = new ParsedArgs();
     testDef.consume(vArgs, pArgs);
     Assert.IsTrue(pArgs.containsKey("test"), "[ArgDef][consume] consume should add a value to the passed in ParsedArgs when the appropriate args are given");
     Assert.AreEqual<int>(33, pArgs.getValue<int>("test"), "[ArgDef][consume] consume should set the appropriate value for the given arg name when encountered.");
 }