1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
extern crate rand; use rand::{Rng, thread_rng}; macro_rules! choose { ( $x:expr ) => { { *thread_rng().choose(&$x).unwrap() } }; } const ANGRY_FACES: &'static [&'static str] = &[ "(╯°□°)╯︵ ┻━┻", "┻━┻︵ \\(°□°)/ ︵ ┻━┻", "(ಠ_ಠ)", "(⌐■_■)", "ヾ(⌐■_■)ノ", "ヽ(`Д´)ノ", "ರ_ರ", "(ノಠ益ಠ)ノ", "ノಠ益ಠ)ノ彡", "( ͠° ͟ʖ ͡°)", "ᕦ(ò_óˇ)ᕤ", "(╯°□°)╯︵(\\ .o.)\\", "(ง ͠° ͟ل͜ ͡°)ง", "(ง ͡ʘ ͜ʖ ͡ʘ)ง", "(ง •̀_•́)ง", "┌( ಠ_ಠ)┘", "╚(ಠ_ಠ)=┐", "(۶ૈ ۜ ᵒ̌▱๋ᵒ̌ )۶ૈ=͟͟͞͞ ⌨", "꒰✘Д✘◍꒱", "( `·´ )", ]; pub fn angry() -> &'static str { choose!(ANGRY_FACES) } const CONFUSED_FACES: &'static [&'static str] = &[ "( '-')", "⊙﹏⊙", "ლ,ᔑ•ﺪ͟͠•ᔐ.ლ", "⚆ _ ⚆", "ノ( º _ ºノ)", "٩◔̯◔۶", "ʅʕ•ᴥ•ʔʃ", ]; pub fn confused() -> &'static str { choose!(CONFUSED_FACES) } const DISAPPOINTED_FACES: &'static [&'static str] = &[ "¬_¬", "( ︶︿︶)", "(;一_一)", ]; pub fn disappointed() -> &'static str { choose!(DISAPPOINTED_FACES) } const EXCITED_FACES: &'static [&'static str] = &[ "☜(⌒▽⌒)☞", "ヽ༼ຈل͜ຈ༽ノ", "ᕕ( ᐛ )ᕗ", "ᕙ༼ຈل͜ຈ༽ᕗ", "ᕙ༼ ,,ԾܫԾ,, ༽ᕗ", "\\m/_(>_<)_\\m/", "/(^.^/)", "(ノ◕ヮ◕)ノ", "t(-.-t)", "ヽ༼ʘ̚ل͜ʘ̚༽ノ", "ヽ༼ຈل͜ຈ༽ง", "ヽ༼ຈل͜ຈ༽ノ", "ヽ༼Ὸل͜ຈ༽ノ", "ヾ(⌐■_■)ノ", ]; pub fn excited() -> &'static str { choose!(EXCITED_FACES) } const HAPPY_FACES: &'static [&'static str] = &[ "( ͜。 ͡ʖ ͜。)", "~(‾▿‾)~", "( ͡° ͜ʖ ͡°)", "(\\_/)", "╚(▲_▲)╝", "(‾⌣‾)♉", "(˚◡˚)", "( ゚ヮ゚)", "٩(❛ᴗ❛)۶", "(。◕ ‿ ◕。)", "(ʘ‿ʘ)", "(ಠ‿ಠ)", "(ಠ⌣ಠ)", "(ღ˘⌣˘ღ)", "(ღ˘⌣˘ღ)", "(ᵔᴥᵔ)", "(•ω•)", "(•◡•)/", "=^.^=", "☼.☼", "♥‿♥", "ʘ‿ʘ", "° ͜ʖ ͡°", ]; pub fn happy() -> &'static str { choose!(HAPPY_FACES) } const MEH_FACES: &'static [&'static str] = &[ "¯\\_(ツ)_/¯", "( ͡° ͜ʖ ͡°)", "(-.-)", ]; pub fn meh() -> &'static str { choose!(MEH_FACES) } const SAD_FACES: &'static [&'static str] = &[ "(¡~¡)", "( ⚆ _ ⚆ )", "༼;´༎ຶ ༎ຶ༽", "༼ ºل͟º ༽", "ಠ╭╮ಠ", ":(", ]; pub fn sad() -> &'static str { choose!(SAD_FACES) } pub fn deal_with_it() -> &'static str { "(⌐■_■)" } pub fn face() -> &'static str { let fns: Vec<fn() -> &'static str> = vec![ angry, confused, disappointed, excited, happy, meh, sad, ]; choose!(fns)() } #[test] fn test_angry() { let f = angry(); println!("{}", f); assert!(ANGRY_FACES.contains(&f)); } #[test] fn test_face() { let f = face(); assert!(ANGRY_FACES.contains(&f) || CONFUSED_FACES.contains(&f) || DISAPPOINTED_FACES.contains(&f) || EXCITED_FACES.contains(&f) || HAPPY_FACES.contains(&f) || MEH_FACES.contains(&f) || SAD_FACES.contains(&f)); }