• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Tests.ComparisonTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中JSIL.Tests.ComparisonTest的典型用法代码示例。如果您正苦于以下问题:C# ComparisonTest类的具体用法?C# ComparisonTest怎么用?C# ComparisonTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ComparisonTest类属于JSIL.Tests命名空间,在下文中一共展示了ComparisonTest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AllSimpleTests

        public void AllSimpleTests()
        {
            var defaultProvider = MakeDefaultProvider();
            var simpleTests = Directory.GetFiles(
                Path.GetFullPath(Path.Combine(ComparisonTest.TestSourceFolder, "SimpleTestCases")),
                "*.cs"
            );
            var failureList = new List<string>();

            foreach (var filename in simpleTests) {
                Console.Write("// {0} ... ", Path.GetFileName(filename));

                try {
                    // We reuse the same type info provider for all the tests in this folder so they run faster
                    using (var test = new ComparisonTest(filename, null, defaultProvider))
                        test.Run();
                } catch (Exception ex) {
                    failureList.Add(Path.GetFileNameWithoutExtension(filename));
                    if (ex.Message == "JS test failed")
                        Debug.WriteLine(ex.InnerException);
                    else
                        Debug.WriteLine(ex);
                }
            }

            Assert.AreEqual(0, failureList.Count,
                String.Format("{0} test(s) failed:\r\n{1}", failureList.Count, String.Join("\r\n", failureList.ToArray()))
            );
        }
开发者ID:robashton,项目名称:JSIL,代码行数:29,代码来源:ComparisonTests.cs


示例2: Chars

 public void Chars()
 {
     using (var test = new ComparisonTest(@"TestCases\Chars.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\CharSwitch.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例3: Casts

 public void Casts()
 {
     using (var test = new ComparisonTest(@"TestCases\CastToBoolean.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\CastingFromNull.cs"))
         test.Run();
 }
开发者ID:Caspeco,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例4: CastingFromNull

 public void CastingFromNull()
 {
     using (var test = new ComparisonTest(@"TestCases\CastingFromNull.cs"))
     {
         test.Run();
     }
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例5: Arithmetic

 public void Arithmetic()
 {
     using (var test = new ComparisonTest(@"TestCases\IntegerArithmetic.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\TernaryArithmetic.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例6: BinaryTrees

 public void BinaryTrees()
 {
     using (var test = new ComparisonTest(@"TestCases\BinaryTrees.cs")) {
         test.Run();
         test.Run("8");
     }
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例7: Enums

 public void Enums()
 {
     using (var test = new ComparisonTest(@"TestCases\Enums.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\EnumArrayLookup.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\EnumSwitch.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\OverloadWithEnum.cs"))
         test.Run();
 }
开发者ID:rozgo,项目名称:JSIL,代码行数:11,代码来源:ComparisonTests.cs


示例8: AllFailingTests

        public void AllFailingTests()
        {
            var testPath = Path.GetFullPath(Path.Combine(ComparisonTest.TestSourceFolder, "FailingTestCases"));
            var simpleTests = Directory.GetFiles(testPath, "*.cs").Concat(Directory.GetFiles(testPath, "*.vb")).ToArray();

            int passCount = 0;

            foreach (var filename in simpleTests) {
                Console.Write("// {0} ... ", Path.GetFileName(filename));

                try {
                    using (var test = new ComparisonTest(filename))
                        test.Run();

                    passCount += 1;
                } catch (Exception ex) {
                    Console.WriteLine("{0}: {1}", ex.GetType().Name, ex.Message);
                }
            }

            Assert.AreEqual(0, passCount, "One or more tests passed that should have failed");
        }
开发者ID:Caspeco,项目名称:JSIL,代码行数:22,代码来源:FailingTests.cs


示例9: EscapesOutputFilenames

        public void EscapesOutputFilenames()
        {
            using (var test = new ComparisonTest(
                EvaluatorPool,
                new[] { @"TestCases\HelloWorld.cs" },
                Portability.NormalizeDirectorySeparators(@"MetadataTests\EscapesOutputFilenames")
            )) {
                var filenames = test.Translate((tr) => {
                    return (from file in tr.OrderedFiles select file.Filename).ToArray();
                }, () => {
                    var configuration = MakeConfiguration();
                    configuration.FilenameEscapeRegex = "[^A-Za-z0-9 _]";
                    return configuration;
                });

                Assert.AreEqual(1, filenames.Length);

                foreach (var filename in filenames) {
                    Assert.IsTrue(Regex.IsMatch(filename, @"^([A-Za-z0-9 _]*)\.js$"), "Filename '{0}' does not match regex.", filename);
                    Console.WriteLine(filename);
                }
            }
        }
开发者ID:jean80it,项目名称:JSIL,代码行数:23,代码来源:MetadataTests.cs


示例10: StaticInitializersInInheritedClasses

 public void StaticInitializersInInheritedClasses()
 {
     using (var test = new ComparisonTest(@"TestCases\StaticInitializersInInheritedClasses.cs"))
     {
         test.Run();
     }
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例11: StaticInitializersInGenericTypesSettingStaticFields

 public void StaticInitializersInGenericTypesSettingStaticFields()
 {
     using (var test = new ComparisonTest(@"TestCases\StaticInitializersInGenericTypesSettingStaticFields.cs"))
     {
         test.Run();
     }
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例12: StaticConstructors

 public void StaticConstructors()
 {
     using (var test = new ComparisonTest(@"TestCases\GenericStaticConstructorOrdering.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\StaticConstructorOrdering.cs"))
         test.Run();
     using (var test = new ComparisonTest(@"TestCases\StaticInitializersInGenericTypesSettingStaticFields.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:9,代码来源:ComparisonTests.cs


示例13: StaticArrays

 public void StaticArrays()
 {
     using (var test = new ComparisonTest(@"TestCases\StaticArrayInitializer.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:5,代码来源:ComparisonTests.cs


示例14: RunComparisonTest

        private CompileResult RunComparisonTest(
            string filename, string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null, Action<string, string> errorCheckPredicate = null,
            List<string> failureList = null, string commonFile = null, bool shouldRunJs = true, AssemblyCache asmCache = null,
            Func<Configuration> makeConfiguration = null, Action<Exception> onTranslationFailure = null,
            string compilerOptions = ""
        )
        {
            CompileResult result = null;
            Console.WriteLine("// {0} ... ", Path.GetFileName(filename));
            filename = Portability.NormalizeDirectorySeparators(filename);

            try {
                var testFilenames = new List<string>() { filename };
                if (commonFile != null)
                    testFilenames.Add(commonFile);

                using (var test = new ComparisonTest(
                    EvaluatorPool,
                    testFilenames,
                    Path.Combine(
                        ComparisonTest.TestSourceFolder,
                        ComparisonTest.MapSourceFileToTestFile(filename)
                    ),
                    stubbedAssemblies, typeInfo, asmCache,
                    compilerOptions: compilerOptions
                )) {
                    result = test.CompileResult;

                    if (shouldRunJs) {
                        test.Run(makeConfiguration: makeConfiguration, onTranslationFailure: onTranslationFailure);
                    } else {
                        string js;
                        long elapsed;
                        try {
                            var csOutput = test.RunCSharp(new string[0], out elapsed);
                            test.GenerateJavascript(new string[0], out js, out elapsed, makeConfiguration, onTranslationFailure);

                            Console.WriteLine("generated");

                            if (errorCheckPredicate != null) {
                                errorCheckPredicate(csOutput, js);
                            }
                        } catch (Exception) {
                            Console.WriteLine("error");
                            throw;
                        }
                    }
                }
            } catch (Exception ex) {
                if (ex.Message == "JS test failed")
                    Debug.WriteLine(ex.InnerException);
                else
                    Debug.WriteLine(ex);

                if (failureList != null) {
                    failureList.Add(Path.GetFileNameWithoutExtension(filename));
                } else
                    throw;
            }

            return result;
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:62,代码来源:GenericTestFixture.cs


示例15: ValueTypeMethods

 public void ValueTypeMethods()
 {
     using (var test = new ComparisonTest(@"TestCases\ValueTypeMethods.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:5,代码来源:ComparisonTests.cs


示例16: MulticastDelegates

 public void MulticastDelegates()
 {
     using (var test = new ComparisonTest(@"TestCases\MulticastDelegates.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:5,代码来源:ComparisonTests.cs


示例17: HelloWorld

 public void HelloWorld()
 {
     using (var test = new ComparisonTest(@"TestCases\HelloWorld.cs")) {
         test.Run();
         test.Run("hello", "world");
     }
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs


示例18: Goto

 public void Goto()
 {
     using (var test = new ComparisonTest(@"TestCases\Goto.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:5,代码来源:ComparisonTests.cs


示例19: FaultBlock

 public void FaultBlock()
 {
     using (var test = new ComparisonTest(@"TestCases\FaultBlock.cs"))
         test.Run();
 }
开发者ID:robashton,项目名称:JSIL,代码行数:5,代码来源:ComparisonTests.cs


示例20: FannkuchRedux

 public void FannkuchRedux()
 {
     using (var test = new ComparisonTest(@"TestCases\FannkuchRedux.cs")) {
         test.Run();
         test.Run("10");
     }
 }
开发者ID:robashton,项目名称:JSIL,代码行数:7,代码来源:ComparisonTests.cs



注:本文中的JSIL.Tests.ComparisonTest类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JTS.InternalEvent类代码示例发布时间:2022-05-26
下一篇:
C# Ast.JSVariable类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap