Skip to content

Commit

Permalink
Claymore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kryptos-FR committed Feb 25, 2022
1 parent 1536f0c commit 3ede686
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/Fragcolor.Chainblocks.Claymore.Tests/ClaymoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ namespace Fragcolor.Chainblocks.Claymore.Tests
internal sealed class ClaymoreTests : TestBase
{
[Test]
public void TestMalformedHash()
public void TestHexToBytes()
{
const string hash = "0xazerty";
Assert.Throws(typeof(ArgumentException), () =>
{
using var result = Claymore.RequestData(hash);
});
Assert.IsEmpty(Util.HexToBytes(""));
Assert.IsEmpty(Util.HexToBytes("0x"));
Assert.Throws(typeof(ArgumentException), () => Util.HexToBytes("zz"));

var bytes = Util.HexToBytes("0x0123456789abcdef");
Assert.AreEqual(8, bytes.Length);
}

[Test]
Expand Down Expand Up @@ -54,6 +55,17 @@ static void Do(Variable v)
}
}

[Test]
public void TestRequestDestructor()
{
{
_ = new GetRequest("");
}
// destructor eventually called when out of scope
GC.Collect();
GC.WaitForPendingFinalizers();
}

[Test]
public void TestUpload()
{
Expand Down

0 comments on commit 3ede686

Please sign in to comment.