Skip to content

Commit

Permalink
Merge pull request #114 from greymistcube/refactor/remove-fingerprint
Browse files Browse the repository at this point in the history
🧹 Remove `Fingerprint`
  • Loading branch information
greymistcube authored Oct 19, 2023
2 parents ce4a8af + e7fe510 commit 5a951d9
Show file tree
Hide file tree
Showing 19 changed files with 4 additions and 834 deletions.
1 change: 0 additions & 1 deletion Bencodex.Tests/CodecTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void SpecTestSuite(Spec spec)
Assert.Equal(spec.Semantics, decoded);
Assert.Equal(spec.Encoding.LongLength, decoded.EncodingLength);
Assert.Equal(spec.Semantics.EncodingLength, decoded.EncodingLength);
Assert.Equal(spec.Semantics.Fingerprint, decoded.Fingerprint);

byte[] encoded = codec.Encode(spec.Semantics);
AssertEqual(spec.Encoding, encoded);
Expand Down
28 changes: 0 additions & 28 deletions Bencodex.Tests/Types/BinaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,34 +157,6 @@ public void Kind()
Assert.Equal(ValueKind.Binary, _hello.Kind);
}

[Fact]
public void Fingerprint()
{
Assert.Equal(new Fingerprint(ValueKind.Binary, 2L), _empty.Fingerprint);
Assert.Equal(
new Fingerprint(ValueKind.Binary, 7L, _hello.ByteArray),
_hello.Fingerprint
);

var longBin = new Binary(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " +
"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis " +
"nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " +
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore " +
"eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, " +
"sunt in culpa qui officia deserunt mollit anim id est laborum.",
Encoding.UTF8
);
Assert.Equal(
new Fingerprint(
ValueKind.Binary,
449L,
ParseHex("cd36b370758a259b34845084a6cc38473cb95e27")
),
longBin.Fingerprint
);
}

[Fact]
public void ToByteArray()
{
Expand Down
21 changes: 0 additions & 21 deletions Bencodex.Tests/Types/BooleanTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ public class BooleanTest
private readonly Boolean _t = new Boolean(true);
private readonly Boolean _f = new Boolean(false);

[Fact]
public void SingletonFingerprints()
{
Assert.Equal(
new Fingerprint(ValueKind.Boolean, 1L, new byte[] { 1 }),
Boolean.TrueFingerprint
);
Assert.Equal(
new Fingerprint(ValueKind.Boolean, 1L, new byte[] { 0 }),
Boolean.FalseFingerprint
);
Assert.NotEqual(Boolean.FalseFingerprint, Boolean.TrueFingerprint);
}

[Fact]
public void Kind()
{
Expand All @@ -37,13 +23,6 @@ public void EncodingLength()
Assert.Equal(1L, _f.EncodingLength);
}

[Fact]
public void Fingerprint()
{
Assert.Equal(new Fingerprint(ValueKind.Boolean, 1L, new byte[] { 1 }), _t.Fingerprint);
Assert.Equal(new Fingerprint(ValueKind.Boolean, 1L, new byte[] { 0 }), _f.Fingerprint);
}

[Fact]
public void Encode()
{
Expand Down
33 changes: 0 additions & 33 deletions Bencodex.Tests/Types/DictionaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,39 +549,6 @@ public void Kind()
Assert.Equal(ValueKind.Dictionary, _binaryKey.Kind);
}

[Fact]
public void Fingerprint()
{
Assert.Equal(
new Fingerprint(ValueKind.Dictionary, 2),
Dictionary.Empty.Fingerprint
);
Assert.Equal(
new Fingerprint(
ValueKind.Dictionary,
14L,
ParseHex("bb1bbb4428e03722aa5e5ad2e0d70657e328dae1")
),
_textKey.Fingerprint
);
Assert.Equal(
new Fingerprint(
ValueKind.Dictionary,
13L,
ParseHex("0a4571a67289be466635ecc577ac136452d8d532")
),
_binaryKey.Fingerprint
);
Assert.Equal(
new Fingerprint(
ValueKind.Dictionary,
33,
ParseHex("83f7620e739e4dd9c6443a93eae4ff9132580ff3")
),
_mixedKeys.Fingerprint
);
}

[Fact]
public void EncodingLength()
{
Expand Down
162 changes: 0 additions & 162 deletions Bencodex.Tests/Types/FingerprintTest.cs

This file was deleted.

29 changes: 0 additions & 29 deletions Bencodex.Tests/Types/IntegerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,35 +160,6 @@ public void EncodingLength()
Assert.Equal(6L, new Integer(-456).EncodingLength);
}

[Fact]
public void Fingerprint()
{
Assert.Equal(
new Fingerprint(ValueKind.Integer, 3L, new byte[] { 0 }),
new Integer(0).Fingerprint
);
Assert.Equal(
new Fingerprint(ValueKind.Integer, 4L, new byte[] { 45 }),
new Integer(45).Fingerprint
);
Assert.Equal(
new Fingerprint(ValueKind.Integer, 6L, new byte[] { 0b10000101 }),
new Integer(-123).Fingerprint
);
BigInteger bigint = BigInteger.Parse(
"10000000000000000000000000000000000000000",
NumberStyles.HexNumber
);
Assert.Equal(
new Fingerprint(
ValueKind.Integer,
51L,
ParseHex("8209ad2f4fad401d8e3d33def02577bd9ab550e5")
),
new Integer(bigint).Fingerprint
);
}

[Theory]
[InlineData(new object[] { false })]
[InlineData(new object[] { true })]
Expand Down
33 changes: 0 additions & 33 deletions Bencodex.Tests/Types/ListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,39 +89,6 @@ public void Kind()
Assert.Equal(ValueKind.List, _nest.Kind);
}

[Fact]
public void Fingerprint()
{
Assert.Equal(
new Fingerprint(ValueKind.List, 2L),
_zero.Fingerprint
);
Assert.Equal(
new Fingerprint(
ValueKind.List,
3L,
ParseHex("d14952314d5de233ef0dd0a178617f7f07ea082c")
),
_one.Fingerprint
);
Assert.Equal(
new Fingerprint(
ValueKind.List,
18L,
ParseHex("16a855873ac787b7c7f2d2d0360119ca4cbb66fe")
),
_two.Fingerprint
);
Assert.Equal(
new Fingerprint(
ValueKind.List,
26L,
ParseHex("82daa9e2ff9f01393b718e09ab9fddd9f8c04e2b")
),
_nest.Fingerprint
);
}

[Fact]
public void EncodingLength()
{
Expand Down
12 changes: 0 additions & 12 deletions Bencodex.Tests/Types/NullTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ public void Value()
Assert.Equal(default(Null), Null.Value);
}

[Fact]
public void SingletonFingerprint()
{
Assert.Equal(new Fingerprint(ValueKind.Null, 1L), Null.SingletonFingerprint);
}

[Fact]
public void Fingerprint()
{
Assert.Equal(new Fingerprint(ValueKind.Null, 1L), Null.Value.Fingerprint);
}

[Fact]
public void EncodingLength()
{
Expand Down
Loading

0 comments on commit 5a951d9

Please sign in to comment.