1#![cfg(feature = "macros")]
2
3#[macro_export(local_inner_macros)]
25#[cfg_attr(all(docsrs, not(doctest)), doc(cfg(feature = "macros")))]
26macro_rules! mods {
27 ( Osu $( : $( $acronym:tt )* )? ) => {
28 mods_inner!(@ Osu: $( $( $acronym )* )?)
29 };
30 ( Taiko $( : $( $acronym:tt )* )? ) => {
31 mods_inner!(@ Taiko: $( $( $acronym )* )?)
32 };
33 ( Catch $( : $( $acronym:tt )* )? ) => {
34 mods_inner!(@ Catch: $( $( $acronym )* )?)
35 };
36 ( Mania $( : $( $acronym:tt )* )? ) => {
37 mods_inner!(@ Mania: $( $( $acronym )* )?)
38 };
39 ( $( $acronym:tt )* ) => {
40 mods_inner!(@ $( $acronym )*)
41 };
42}
43
44pub use pastey::paste;
45
46#[cfg(test)]
47mod tests {
48 #[test]
49 fn empty_intermode() {
50 let mods = mods!();
51 assert!(mods.is_empty());
52 }
53
54 #[test]
55 fn single_intermode() {
56 let mods = mods!(WG);
57 assert_eq!(mods.len(), 1);
58 }
59
60 #[test]
61 fn full_intermode() {
62 let mods = mods!(HD DT DT HR TC);
63 assert_eq!(mods.to_string(), "DTHDHRTC");
64 }
65
66 #[test]
67 fn empty_catch() {
68 let mods = mods!(Catch);
69 assert!(mods.is_empty());
70 }
71
72 #[test]
73 fn full_taiko() {
74 let mods = mods!(Taiko: HR PF);
75 assert_eq!(mods.len(), 2);
76 }
77}