public void DecodeTest(byte[] expBa, Bech32.Mode mode, byte expWitVer, string expHrp, string bechStr) { byte[] actualBa = Bech32.Decode(bechStr, mode, out byte actualWitVer, out string actualHrp); Assert.Equal(expBa, actualBa); Assert.Equal(expWitVer, actualWitVer); Assert.Equal(expHrp, actualHrp); }
public void Decode_ExceptionTests(string bech, Bech32.Mode mode, byte expWitVer, string expHrp, string expErr) { byte actWitVer = 255; string actHrp = "."; Exception ex = Assert.Throws <FormatException>(() => Bech32.Decode(bech, mode, out actWitVer, out actHrp)); Assert.Equal(expWitVer, actWitVer); Assert.Equal(expHrp, actHrp); Assert.Contains(expErr, ex.Message); bool b = Bech32.TryDecode(bech, mode, out byte[] result, out actWitVer, out actHrp); Assert.False(b); Assert.Null(result); Assert.Equal(0, actWitVer); }
public void IsValid_FailTest(string input, Bech32.Mode mode) { Assert.False(Bech32.IsValid(input, mode)); }
public void IsValidTest(string input, Bech32.Mode mode) { Assert.True(Bech32.IsValid(input, mode)); }
public void EncodeTest(byte[] data, Bech32.Mode mode, byte witVer, string hrp, string expected) { string actual = Bech32.Encode(data, mode, witVer, hrp); Assert.Equal(expected, actual, ignoreCase: true); }