convert palette id to int
This commit is contained in:
22
src/lib.rs
22
src/lib.rs
@@ -1,3 +1,5 @@
|
||||
use radix_fmt::radix_36;
|
||||
|
||||
pub mod avatar;
|
||||
pub mod colour;
|
||||
pub mod dialogue;
|
||||
@@ -62,3 +64,23 @@ impl AnimationFrames for Vec<Image> {
|
||||
string
|
||||
}
|
||||
}
|
||||
|
||||
fn from_base36(str: &str) -> u64 {
|
||||
u64::from_str_radix(str, 36).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_base36() {
|
||||
assert_eq!(from_base36("0"), 0);
|
||||
assert_eq!(from_base36("0z"), 35);
|
||||
assert_eq!(from_base36("11"), 37);
|
||||
}
|
||||
|
||||
fn to_base36(input: u64) -> String {
|
||||
format!("{}", radix_36(input))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_base36() {
|
||||
assert_eq!(to_base36(37), "11");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user