From 14e7eff98a3c90e4e0ed34f33893eec528cc1d0a Mon Sep 17 00:00:00 2001 From: Benjamin Van Renterghem <42121860+benjaminvanrenterghem@users.noreply.github.com> Date: Wed, 8 May 2024 19:42:02 +0200 Subject: [PATCH] dotnet.Nyzo.CL - add NyzoConverterTests.cs --- dotnet.Nyzo.CL.Tests/NyzoConverterTests.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dotnet.Nyzo.CL.Tests/NyzoConverterTests.cs diff --git a/dotnet.Nyzo.CL.Tests/NyzoConverterTests.cs b/dotnet.Nyzo.CL.Tests/NyzoConverterTests.cs new file mode 100644 index 0000000..8186d16 --- /dev/null +++ b/dotnet.Nyzo.CL.Tests/NyzoConverterTests.cs @@ -0,0 +1,24 @@ +using Nyzo.CL.Tests.@internal; +using System.Collections.Generic; + +namespace Nyzo.CL.Tests; + + +public class NyzoConverterTests { + private List _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)); + } +}