public void AllXMLTests() { Console.WriteLine("// Spidermonkey has no DOMParser so this test only generates the .js files."); Console.WriteLine("// To run the .js files, click a link below."); Console.WriteLine(); var typeInfo = MakeDefaultProvider(); var testPath = Path.GetFullPath(Path.Combine(ComparisonTest.TestSourceFolder, "XMLTestCases")); var xmlTests = Directory.GetFiles(testPath, "*.cs").Concat(Directory.GetFiles(testPath, "*.vb")).ToArray(); try { RunComparisonTests( xmlTests, null, typeInfo, (testFile) => { Console.WriteLine(ComparisonTest.GetTestRunnerLink(testFile)); return(false); }, (csharpOutput, js) => Console.WriteLine(csharpOutput) ); } catch (Exception exc) { Console.WriteLine(exc.Message); } }
public void AllFailingTests() { var testPath = Path.GetFullPath(Path.Combine(ComparisonTest.TestSourceFolder, "FailingTestCases")); var simpleTests = Directory.GetFiles(testPath, "*.cs").Concat(Directory.GetFiles(testPath, "*.vb")).ToArray(); List <string> passedTests = new List <string>(); foreach (var filename in simpleTests) { Console.WriteLine("// {0} ... ", Path.GetFileName(filename)); try { using (var test = MakeTest(filename)) { test.JavascriptExecutionTimeout = 5.0f; test.Run(); Console.WriteLine("// {0}", ComparisonTest.GetTestRunnerLink(test.OutputPath)); } passedTests.Add(Path.GetFileName(filename)); } catch (JavaScriptException jse) { Console.WriteLine(jse.ToString()); } catch (AssertionException ex) { Console.WriteLine(ex.ToString()); } } if (passedTests.Count > 0) { Assert.Fail("One or more tests passed that should have failed:\r\n" + String.Join("\r\n", passedTests)); } }
public void UnsafeIntPerformanceComparison() { using (var test = MakeTest( @"PerformanceTestCases\UnsafeIntPerformanceComparison.cs" )) { Console.WriteLine("// {0}", ComparisonTest.GetTestRunnerLink(test.OutputPath)); Console.WriteLine(test.RunJavascript(null, MakeUnsafeConfiguration)); } }
public void Vector3() { using (var test = MakeTest( @"PerformanceTestCases\Vector3.cs" )) { Console.WriteLine("// {0}", ComparisonTest.GetTestRunnerLink(test.OutputPath)); long elapsedcs; Console.WriteLine("C#:\r\n{0}", test.RunCSharp(null, out elapsedcs)); Console.WriteLine("JS:\r\n{0}", test.RunJavascript(null, makeConfiguration: MakeUnsafeConfiguration)); } }
public void BaseMethodCalls() { using (var test = MakeTest( @"PerformanceTestCases\BaseMethodCalls.cs" )) { Console.WriteLine("// {0}", ComparisonTest.GetTestRunnerLink(test.OutputPath)); long elapsedcs; Console.WriteLine("C#:\r\n{0}", test.RunCSharp(null, out elapsedcs)); Console.WriteLine("JS:\r\n{0}", test.RunJavascript(null)); } }
public void PropertyVsField() { using (var test = MakeTest( @"PerformanceTestCases\PropertyVsField.cs" )) { Console.WriteLine("// {0}", ComparisonTest.GetTestRunnerLink(test.OutputPath)); long elapsedcs; Console.WriteLine("C#:\r\n{0}", test.RunCSharp(null, out elapsedcs)); Console.WriteLine("JS:\r\n{0}", test.RunJavascript( null, makeConfiguration: () => { var cfg = MakeConfiguration(); cfg.CodeGenerator.PreferAccessorMethods = true; return(cfg); } )); } }