Skip to content

Instantly share code, notes, and snippets.

@chrisforbes
Created January 26, 2011 08:34
Show Gist options
  • Save chrisforbes/796424 to your computer and use it in GitHub Desktop.
Save chrisforbes/796424 to your computer and use it in GitHub Desktop.
// 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