forked from AbleScript/ablescript
fixed base 55
This commit is contained in:
parent
7f859081ba
commit
bf0e64c26a
|
@ -1,4 +1,4 @@
|
||||||
pub fn char2num(character: char) -> i32 {
|
pub fn char2num(character: char) -> isize {
|
||||||
match character {
|
match character {
|
||||||
'Z' => -26,
|
'Z' => -26,
|
||||||
'Y' => -25,
|
'Y' => -25,
|
||||||
|
@ -66,7 +66,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn str_to_base55() {
|
fn str_to_base55() {
|
||||||
let chrs: Vec<i32> = "AbleScript".chars().map(char2num).collect();
|
let chrs: Vec<isize> = "AbleScript".chars().map(char2num).collect();
|
||||||
assert_eq!(chrs, &[-1, 2, 12, 5, -19, 3, 18, 9, 16, 20]);
|
assert_eq!(chrs, &[-1, 2, 12, 5, -19, 3, 18, 9, 16, 20]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue