public void TestDecodeBytes() { var bytes = Rfc1751.Decode("TROD MUTE TAIL WARM CHAR KONG HAAG CITY BORE O TEAL AWL", out var parityError); Assert.Equal("EFF81F9BFBC65350920CDD7416DE8009", Base16.Encode(bytes.Span)); Assert.False(parityError); }
public void TestDecode(ulong expected, string words) { var split = words.Split(" "); var bits = Rfc1751.Decode(split[0], split[1], split[2], split[3], split[4], split[5], out var parityError); Assert.Equal(expected, bits); Assert.False(parityError); }
public Property TestRoundTrip() { return(Prop.ForAll( Arb.From <ulong>(), bits => { var words = Rfc1751.Encode(bits); var split = words.Split(" "); var result = Rfc1751.Decode(split[0], split[1], split[2], split[3], split[4], split[5], out var parityError); Assert.Equal(bits, result); Assert.False(parityError); })); }
public Property TestRoundTripBytes() { var arb = Arb.From <byte[]>().Filter(bytes => bytes.Length % 8 == 0); return(Prop.ForAll( arb, bytes => { var words = Rfc1751.Encode(bytes); var result = Rfc1751.Decode(words, out var parityError); Assert.Equal(Base16.Encode(bytes), Base16.Encode(result.Span)); Assert.False(parityError); })); }