本文整理汇总了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");
}
示例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'");
}