Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/decode_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ mod tests {
buffer.clear();
decode(test.encoded, &mut buffer, test.bits).unwrap();
assert_eq!(&buffer[..], test.unencoded);
buffer = Vec::new();
decode(test.encoded.replace("z", "2").as_str(), &mut buffer, test.bits).unwrap();
assert_eq!(&buffer[..], test.unencoded,
"failed to decode when 2 replaces z: {} (got: {:?})", test.encoded, buffer);
buffer = Vec::new();
decode(test.encoded.replace("o", "0").as_str(), &mut buffer, test.bits).unwrap();
assert_eq!(&buffer[..], test.unencoded,
"failed to decode when 0 replaces o: {} (got: {:?})", test.encoded, buffer);
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/tables.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Maps from character code to their value in the z-base-32 scheme
// Table starts from character code 49 ('1')
pub const CHARACTER_MIN_VALUE: u8 = 49;
// Table starts from character code 48 ('0')
pub const CHARACTER_MIN_VALUE: u8 = 48;
pub const CHARACTER_TO_QUINTET: &'static [u8] = &[
16, // '0' (misread of 'O')
18, // '1'
255, 25, // '3'
23, // '2' (misread of 'Z')
25, // '3'
26, // '4'
27, // '5'
30, // '6'
Expand Down