Created
January 26, 2011 08:34
-
-
Save chrisforbes/796424 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// format80 roundtrip | |
var bytes = new List<byte>(); | |
for (var q = 0; q < 4096; q++) | |
bytes.Add((byte)q); | |
var src = bytes.ToArray(); | |
var encoded = Format80.Encode(src); | |
var decoded = new byte[src.Length]; | |
if (Format80.DecodeInto(encoded, decoded) != src.Length) | |
throw new InvalidOperationException("Bogus length"); | |
for (var q = 0; q < src.Length; q++) | |
if (src[q] != decoded[q]) | |
throw new InvalidOperationException( | |
string.Format("Bogus value at byte {0}; expected {1:x2} got {2:x2}", | |
q, src[q], decoded[q])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment