Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
		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;
		}
Ejemplo n.º 3
0
		static string GetDefaultExpectedResultFile (MethodInfo method, CompiledTestCaseAttribute attribute)
		{
			return Path.Combine (
				attribute.LanguageName,
				method.DeclaringType.Name + "." + method.Name + ".txt");
		}
Ejemplo n.º 4
0
		static string GetDefaultSourceFile (MethodInfo method, CompiledTestCaseAttribute attribute)
		{
			return Path.Combine (
				attribute.LanguageName,
				method.DeclaringType.Name + attribute.SourceFileExtension);
		}
Ejemplo n.º 5
0
 static string GetDefaultExpectedResultFile(MethodInfo method, CompiledTestCaseAttribute attribute)
 {
     return(Path.Combine(
                attribute.LanguageName,
                method.DeclaringType.Name + "." + method.Name + ".txt"));
 }
Ejemplo n.º 6
0
 static string GetDefaultSourceFile(MethodInfo method, CompiledTestCaseAttribute attribute)
 {
     return(Path.Combine(
                attribute.LanguageName,
                method.DeclaringType.Name + attribute.SourceFileExtension));
 }