本文整理汇总了C#中Group.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# Group.CompareTo方法的具体用法?C# Group.CompareTo怎么用?C# Group.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group.CompareTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCompareGroups
public void TestCompareGroups()
{
var a = new Group(new int[]{13, 15});
var b = new Group(new int[]{13, 15});
var c = new Group(new int[]{13, 14});
Assert.True(a.CompareTo(b) == 0);
Assert.True(a.CompareTo(c) > 0);
Assert.True(b.CompareTo(c) > 0);
Assert.True(a.CompareTo(c) >= 0);
Assert.True(b.CompareTo(c) != 0);
}
示例2: TestUnion2
public void TestUnion2()
{
Group a = new Group();
a.Add(0);
a.Add(10);
Group b = new Group();
Group c = a + b;
Assert.True(a.CompareTo(c) == 0);
}
示例3: TestSize
public void TestSize()
{
Group a = new Group();
a.Add(0);
a.Add(10);
Assert.AreEqual(10, Group.Size(a));
Assert.True(a.CompareTo(5) > 0);
Assert.True(a.CompareTo(12) < 0);
Assert.True(a.CompareTo(10) <= 0);
Assert.False(a.CompareTo(10) < 0);
Assert.True(a.CompareTo(10) >= 0);
}
示例4: TestFilter
public void TestFilter()
{
var g = new Group(new int[]{1,100});
g *= delegate (int i) {
return i % 10 == 0;
};
Assert.True(g [0] == 10);
Assert.True(g [1] == 11);
Assert.True(g [2] == 20);
Assert.True(g [3] == 21);
Assert.True(g [4] == 30);
Assert.True(g [5] == 31);
Assert.True(g [6] == 40);
Assert.True(g [7] == 41);
Assert.True(g [8] == 50);
Assert.True(g [9] == 51);
Assert.True(g [10] == 60);
Assert.True(g [11] == 61);
Assert.True(g [12] == 70);
Assert.True(g [13] == 71);
Assert.True(g [14] == 80);
Assert.True(g [15] == 81);
Assert.True(g [16] == 90);
Assert.True(g [17] == 91);
Assert.True(g.CompareTo(9) == 0);
}