private int runTest(Type type, Method method)
{
Method setup = type.method("setup", true);
Method teardown = type.method("teardown", true);
FanSysTest test = null;
List args = null;
try
{
test = (FanSysTest)type.make();
args = new List(Sys.ObjType, new object[] {test});
}
catch (System.Exception e)
{
System.Console.WriteLine();
System.Console.WriteLine("ERROR: Cannot make test " + type);
if (e is Err.Val)
((Err.Val)e).err().trace();
else
Err.dumpStack(e);
return -1;
}
try
{
test.m_curTestMethod = method;
setup.callList(args);
method.callList(args);
return test.verifyCount;
}
catch (System.Exception e)
{
//System.Console.WriteLine(" -- " + e.GetType() + " -- ");
System.Console.WriteLine();
System.Console.WriteLine("TEST FAILED");
if (e is Err.Val)
((Err.Val)e).err().trace();
else
Err.dumpStack(e);
return -1;
}
finally
{
try
{
if (args != null) teardown.callList(args);
}
catch (System.Exception e)
{
Err.dumpStack(e);
}
test.m_curTestMethod = null;
}
}