mirror of
https://github.com/YGGverse/plurify.git
synced 2026-03-31 17:15:36 +00:00
implement trait for usize, rename ns to plurify
This commit is contained in:
parent
89675db0e8
commit
5aeb139caa
4 changed files with 65 additions and 25 deletions
|
|
@ -1,15 +1,24 @@
|
|||
use plurify::ns;
|
||||
#[cfg(test)]
|
||||
use plurify::*;
|
||||
|
||||
#[test]
|
||||
fn _ns() {
|
||||
fn test() {
|
||||
let en = &["cat", "cats", "cats"];
|
||||
let uk = &["кіт", "кота", "котів"];
|
||||
|
||||
assert_eq!(ns(1, en), "cat");
|
||||
assert_eq!(ns(2, en), "cats");
|
||||
assert_eq!(ns(5, en), "cats");
|
||||
assert_eq!(plurify(1, en), "cat");
|
||||
assert_eq!(plurify(2, en), "cats");
|
||||
assert_eq!(plurify(5, en), "cats");
|
||||
|
||||
assert_eq!(ns(1, uk), "кіт");
|
||||
assert_eq!(ns(2, uk), "кота");
|
||||
assert_eq!(ns(5, uk), "котів");
|
||||
assert_eq!(plurify(1, uk), "кіт");
|
||||
assert_eq!(plurify(2, uk), "кота");
|
||||
assert_eq!(plurify(5, uk), "котів");
|
||||
|
||||
assert_eq!(1.plurify(en), "cat");
|
||||
assert_eq!(2.plurify(en), "cats");
|
||||
assert_eq!(5.plurify(en), "cats");
|
||||
|
||||
assert_eq!(1.plurify(uk), "кіт");
|
||||
assert_eq!(2.plurify(uk), "кота");
|
||||
assert_eq!(5.plurify(uk), "котів");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue