当前位置: 首页>>代码示例>>C#>>正文


C# CharSetSolver.GetMin方法代码示例

本文整理汇总了C#中CharSetSolver.GetMin方法的典型用法代码示例。如果您正苦于以下问题:C# CharSetSolver.GetMin方法的具体用法?C# CharSetSolver.GetMin怎么用?C# CharSetSolver.GetMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CharSetSolver的用法示例。


在下文中一共展示了CharSetSolver.GetMin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MinMaxTest

 public void MinMaxTest()
 {
     CharSetSolver solver = new CharSetSolver(BitWidth.BV16);
     var ranges = new char[][] {
         new char[] {'\u55A0', '\u55AA'},
         new char[] { 'a', 'c' },
         new char[] {'\u5555', '\u55A5'},
         new char[] { 'e', 'h' }
     };
     BDD s = solver.MkRangesConstraint(false, ranges);
     char c = solver.GetMax(s);
     Assert.AreEqual<char>('\u55AA', c, "not the maximum character");
     c = (char)solver.GetMin(s);
     Assert.AreEqual<char>('a', c, "not the minimum character");
 }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:15,代码来源:CharSetSolverTests.cs

示例2: GenerateMembersTest2

        public void GenerateMembersTest2()
        {
            CharSetSolver solver = new CharSetSolver(BitWidth.BV16);
            var ranges = new char[][] {
                new char[] { 'a', 'c' },
                new char[] {'\u5555', '\u55A5'},
                new char[] { 'e', 'h' },
                new char[] {'\u55A0', '\u55AA'},
            };
            BDD s = solver.MkRangesConstraint(false, ranges);
            s.ToDot("bug.dot");

            var r = solver.ToRanges(s);
            var s2 = solver.MkCharSetFromRanges(r);

            var members = new List<char>(solver.GenerateAllCharacters(s2, false));
            var smallest = (char)solver.GetMin(s2);

            Assert.AreEqual<int>(93, members.Count, "wrong number of members in the range [a-ce-h\\u5555-\\u55AA]");
            Assert.AreEqual<char>('a', members[0], "the smallest character in the range must be 'a'");
            Assert.AreEqual<char>('\u55AA', members[members.Count - 1], "the largest character in the range must be '\\u55AA'");

            var membersInReverse = new List<char>(solver.GenerateAllCharacters(s, true));

            Assert.AreEqual<int>(93, membersInReverse.Count, "wrong number of members in the range [a-ce-h\\u5555-\\u55AA]");
            Assert.AreEqual<char>('\u55AA', membersInReverse[0], "the first character in the reverse enumeration must be '\\u55AA'");
            Assert.AreEqual<char>('a', membersInReverse[membersInReverse.Count-1], "the last character in the reverse enumeration must be 'a'");
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:28,代码来源:CharSetSolverTests.cs


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