本文整理汇总了C#中Fingerprint.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Fingerprint.Equals方法的具体用法?C# Fingerprint.Equals怎么用?C# Fingerprint.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fingerprint
的用法示例。
在下文中一共展示了Fingerprint.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquality
public void TestEquality()
{
Fingerprint fp1 = new Fingerprint(65);
Fingerprint fp2 = new Fingerprint(65);
Fingerprint fp3 = new Fingerprint(64);
Fingerprint fp4 = new Fingerprint(66);
// Reference first
Assert.True(fp1.Equals(fp1));
Assert.True(fp2.Equals(fp2));
Assert.True(fp3.Equals(fp3));
Assert.True(fp4.Equals(fp4));
// Type second
Assert.False(fp1.Equals(new Object()));
// Length third
Assert.False(fp3.Equals(fp1));
Assert.False(fp1.Equals(fp3));
Assert.False(fp4.Equals(fp2));
Assert.False(fp2.Equals(fp4));
// Bits forth
Assert.True(fp1.Equals(fp2));
Assert.True(fp2.Equals(fp1));
fp1.Touch(32);
Assert.False(fp1.Equals(fp2));
Assert.False(fp2.Equals(fp1));
fp2.Touch(32);
Assert.True(fp1.Equals(fp2));
Assert.True(fp2.Equals(fp1));
// Length <= 32
var fp5 = new Fingerprint(7);
var fp6 = new Fingerprint(7);
fp5.Touch(0);
Assert.False(fp5.Equals(fp6));
fp6.Touch(0);
Assert.True(fp5.Equals(fp6));
}
示例2: TestSerialization
public void TestSerialization()
{
Fingerprint fp1 = new Fingerprint(65);
Fingerprint fp2 = new Fingerprint(65);
fp1.Touch(0);
fp1.Touch(2);
fp1.Touch(31);
fp1.Touch(32);
Assert.False(fp2.Equals(fp1));
var buffer = new x2.Buffer();
fp1.Serialize(new Serializer(buffer));
buffer.Rewind();
fp2.Deserialize(new Deserializer(buffer));
Assert.True(fp2.Equals(fp1));
}
示例3: TestSerialization
public void TestSerialization()
{
Fingerprint fp1 = new Fingerprint(65);
Fingerprint fp2 = new Fingerprint(65);
fp1.Touch(0);
fp1.Touch(2);
fp1.Touch(31);
fp1.Touch(32);
Assert.False(fp2.Equals(fp1));
/*
Buffer buffer = new Buffer(12);
fp1.Dump(buffer);
buffer.Rewind();
fp2.Load(buffer);
Assert.True(fp2.Equals(fp1));
*/
}