fakeit/
hacker.rs

1use crate::data::hacker;
2use crate::generator;
3use crate::misc;
4
5pub fn phrase() -> String {
6    let phrase = misc::random_data(hacker::PHRASE).to_string();
7    generator::generate(phrase)
8}
9
10pub fn abbreviation() -> String {
11    misc::random_data(hacker::ABBREVIATION).to_string()
12}
13
14pub fn adjective() -> String {
15    misc::random_data(hacker::ADJECTIVE).to_string()
16}
17
18pub fn noun() -> String {
19    misc::random_data(hacker::NOUN).to_string()
20}
21
22pub fn verb() -> String {
23    misc::random_data(hacker::VERB).to_string()
24}
25
26pub fn ingverb() -> String {
27    misc::random_data(hacker::INGVERB).to_string()
28}
29
30#[cfg(test)]
31mod tests {
32    use crate::hacker;
33    use crate::testify::exec_mes;
34
35    #[test]
36    fn phrase() {
37        exec_mes("hacker::phrase", || hacker::phrase());
38    }
39
40    #[test]
41    fn abbreviation() {
42        exec_mes("hacker::abbreviation", || hacker::abbreviation());
43    }
44
45    #[test]
46    fn adjective() {
47        exec_mes("hacker::adjective", || hacker::adjective());
48    }
49
50    #[test]
51    fn noun() {
52        exec_mes("hacker::noun", || hacker::noun());
53    }
54
55    #[test]
56    fn verb() {
57        exec_mes("hacker::verb", || hacker::verb());
58    }
59
60    #[test]
61    fn ingverb() {
62        exec_mes("hacker::ingverb", || hacker::ingverb());
63    }
64}