public void T01_SimpleEncoder_UseOfSpecials() { byte[] chars = { 92, 43, 0 }; byte[] escape_list = { 47, 43 }; byte escape_char = 43; SimpleEncoder enc = new SimpleEncoder(escape_list, escape_char); byte[] output = enc.encode(enc.encode(chars)); byte[] decoded_version = enc.decode(enc.decode(output)); Assert.AreEqual(chars, decoded_version, "binary decoded version does not match original"); }
public void T00_SimpleEncoder() { byte CH_SLASH = 47; byte CH_PLUS = 43; byte[] input = { 1, 2, 3, 4, 47, 5, 6 }; byte[] expected_output = { 1, 2, 3, 4, 43, 0, 5, 6 }; byte[] escape_list = { CH_SLASH, CH_PLUS }; byte escape_char = 43; SimpleEncoder enc = new SimpleEncoder(escape_list, escape_char); byte[] output = enc.encode(input); Assert.AreEqual(output, expected_output, "encoded form is incorrect"); byte[] decoded_version = enc.decode(output); Assert.AreEqual(input, decoded_version, "decoded version does not match original"); }