Added macro for easier usage
Updated docs Added option to add seperator to the output
This commit is contained in:
+13
-10
@@ -10,8 +10,7 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn numbers() {
|
||||
use crate::to_text;
|
||||
|
||||
use crate::to_text_no_seperator as to_text;
|
||||
assert_eq!(to_text(1), "one");
|
||||
assert_eq!(to_text(10), "ten");
|
||||
assert_eq!(to_text(100), "onehundred");
|
||||
@@ -21,13 +20,17 @@ mod tests {
|
||||
assert_eq!(to_text(12), "twelve");
|
||||
}
|
||||
#[test]
|
||||
fn tens() {
|
||||
use crate::tens_place;
|
||||
assert_eq!(tens_place(1, 2).unwrap(), "twelve");
|
||||
assert_eq!(tens_place(7, 6).unwrap(), "seventysix");
|
||||
assert_eq!(tens_place(5, 7).unwrap(), "fiftyseven");
|
||||
assert_eq!(tens_place(2, 3).unwrap(), "twentythree");
|
||||
assert_eq!(tens_place(6, 9).unwrap(), "sixtynine");
|
||||
assert_eq!(tens_place(0, 9).unwrap(), "nine");
|
||||
fn numbers_seperator() {
|
||||
use crate::to_text_with_seperator as to_text;
|
||||
assert_eq!(to_text(103, "/"), "one/hundred/three");
|
||||
assert_eq!(to_text(1000, "/"), "one/thousand");
|
||||
assert_eq!(
|
||||
to_text(12345, "/"),
|
||||
"twelve/thousand/three/hundred/forty/five"
|
||||
);
|
||||
assert_eq!(
|
||||
to_text(651243, "/"),
|
||||
"six/million/fifty/one/thousand/two/hundred/forty/three"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user