本文整理汇总了C#中Fingerprint.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# Fingerprint.CompareTo方法的具体用法?C# Fingerprint.CompareTo怎么用?C# Fingerprint.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fingerprint
的用法示例。
在下文中一共展示了Fingerprint.CompareTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestComparison
public void TestComparison()
{
Fingerprint fp1 = new Fingerprint(65);
Fingerprint fp2 = new Fingerprint(65);
Fingerprint fp3 = new Fingerprint(64);
Fingerprint fp4 = new Fingerprint(66);
// Length first
Assert.Less(fp3.CompareTo(fp1), 0);
Assert.Greater(fp1.CompareTo(fp3), 0);
fp3.Touch(2);
Assert.Less(fp3.CompareTo(fp1), 0);
Assert.Greater(fp1.CompareTo(fp3), 0);
Assert.Greater(fp4.CompareTo(fp2), 0);
Assert.Less(fp2.CompareTo(fp4), 0);
fp2.Touch(64);
Assert.Greater(fp4.CompareTo(fp2), 0);
Assert.Less(fp2.CompareTo(fp4), 0);
fp2.Wipe(64);
// Bits second
Assert.AreEqual(0, fp1.CompareTo(fp2));
fp1.Touch(31);
Assert.Greater(fp1.CompareTo(fp2), 0);
Assert.Less(fp2.CompareTo(fp1), 0);
fp2.Touch(32);
Assert.Less(fp1.CompareTo(fp2), 0);
Assert.Greater(fp2.CompareTo(fp1), 0);
fp1.Touch(32);
Assert.Greater(fp1.CompareTo(fp2), 0);
Assert.Less(fp2.CompareTo(fp1), 0);
fp2.Touch(31);
Assert.AreEqual(0, fp1.CompareTo(fp2));
Assert.AreEqual(0, fp2.CompareTo(fp1));
fp2.Touch(64);
Assert.Less(fp1.CompareTo(fp2), 0);
Assert.Greater(fp2.CompareTo(fp1), 0);
}