Skip to content

Commit

Permalink
dotnet.Nyzo.CL - add NyzoConverterTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminvanrenterghem committed May 8, 2024
1 parent 6b276fb commit 14e7eff
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dotnet.Nyzo.CL.Tests/NyzoConverterTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Nyzo.CL.Tests.@internal;
using System.Collections.Generic;

namespace Nyzo.CL.Tests;


public class NyzoConverterTests {
private List<CryptographicInlineData> _vectors { get; init; } = new SodiumPublicKeyAuthTests().Ed25519_RFC8032_TestVectors;

[Fact]
public void PublicIdentifierForPrivateKey_ShouldReturnInstance_OrNull() {
foreach(var vector in _vectors) {
Assert.Equal(vector.NyzoStringPublicIdentifier, NyzoConverter.PublicIdentifierForPrivateKey(vector.NyzoStringPrivateKey!));
}
}

[Fact]
public void GetDisplayAmount_ShouldBeAccurate() {
var amount = 1;

Assert.EndsWith("0.000001", NyzoConverter.GetDisplayAmount(amount, true));
Assert.EndsWith("1.000000", NyzoConverter.GetDisplayAmount(amount, false));
}
}

0 comments on commit 14e7eff

Please sign in to comment.