static DecompilerTestCase CreateTestCase(MethodInfo method, CompiledTestCaseAttribute attribute, CompilationMode mode) { var test_case = new DecompilerTestCase(method, mode); test_case.Language = attribute.GetLanguage(); test_case.Compiler = attribute.CreateCompiler(); test_case.CompilerParameters = attribute.CreateParamaters(); if (mode == CompilationMode.Release) { test_case.CompilerParameters.CompilerOptions = "/optimize+"; } else { test_case.CompilerParameters.CompilerOptions = "/debug+ /optimize-"; } test_case.SourceFile = GetTestCaseFile(attribute.SourceFile ?? GetDefaultSourceFile(method, attribute)); test_case.ExpectedResultFile = GetTestCaseFile(attribute.ExpectedResultFile ?? GetDefaultExpectedResultFile(method, attribute)); test_case.MethodName = attribute.MethodName ?? GetDefaultMethodName(method); test_case.CompilerParameters.OutputAssembly = test_case.ExpectedResultFile + "." + mode + ".dll"; return(test_case); }
static DecompilerTestCase CreateTestCase (MethodInfo method, CompiledTestCaseAttribute attribute, CompilationMode mode) { var test_case = new DecompilerTestCase (method, mode); test_case.Language = attribute.GetLanguage (); test_case.Compiler = attribute.CreateCompiler (); test_case.CompilerParameters = attribute.CreateParamaters (); if (mode == CompilationMode.Release) test_case.CompilerParameters.CompilerOptions = "/optimize+"; else test_case.CompilerParameters.CompilerOptions = "/debug+ /optimize-"; test_case.SourceFile = GetTestCaseFile (attribute.SourceFile ?? GetDefaultSourceFile (method, attribute)); test_case.ExpectedResultFile = GetTestCaseFile (attribute.ExpectedResultFile ?? GetDefaultExpectedResultFile (method, attribute)); test_case.MethodName = attribute.MethodName ?? GetDefaultMethodName (method); test_case.CompilerParameters.OutputAssembly = test_case.ExpectedResultFile + "." + mode + ".dll"; return test_case; }
static string GetDefaultExpectedResultFile (MethodInfo method, CompiledTestCaseAttribute attribute) { return Path.Combine ( attribute.LanguageName, method.DeclaringType.Name + "." + method.Name + ".txt"); }
static string GetDefaultSourceFile (MethodInfo method, CompiledTestCaseAttribute attribute) { return Path.Combine ( attribute.LanguageName, method.DeclaringType.Name + attribute.SourceFileExtension); }
static string GetDefaultExpectedResultFile(MethodInfo method, CompiledTestCaseAttribute attribute) { return(Path.Combine( attribute.LanguageName, method.DeclaringType.Name + "." + method.Name + ".txt")); }
static string GetDefaultSourceFile(MethodInfo method, CompiledTestCaseAttribute attribute) { return(Path.Combine( attribute.LanguageName, method.DeclaringType.Name + attribute.SourceFileExtension)); }