Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
        public void UnsafeIntPerformanceComparison()
        {
            using (var test = MakeTest(
                       @"PerformanceTestCases\UnsafeIntPerformanceComparison.cs"
                       )) {
                Console.WriteLine("// {0}", ComparisonTest.GetTestRunnerLink(test.OutputPath));

                Console.WriteLine(test.RunJavascript(null, MakeUnsafeConfiguration));
            }
        }
Ejemplo n.º 4
0
        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));
            }
        }
Ejemplo n.º 5
0
        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));
            }
        }
Ejemplo n.º 6
0
        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);
                }
                                      ));
            }
        }