faker_rust/default/
ancient.rs1use crate::base::sample;
4use crate::locale::fetch_locale;
5
6pub fn god() -> String {
8 fetch_locale("ancient.god", "en")
9 .map(|v| sample(&v))
10 .unwrap_or_else(|| "Zeus".to_string())
11}
12
13pub fn primordial() -> String {
15 fetch_locale("ancient.primordial", "en")
16 .map(|v| sample(&v))
17 .unwrap_or_else(|| "Chaos".to_string())
18}
19
20pub fn titan() -> String {
22 fetch_locale("ancient.titan", "en")
23 .map(|v| sample(&v))
24 .unwrap_or_else(|| "Atlas".to_string())
25}
26
27pub fn hero() -> String {
29 fetch_locale("ancient.hero", "en")
30 .map(|v| sample(&v))
31 .unwrap_or_else(|| "Hercules".to_string())
32}
33
34pub fn location() -> String {
36 fetch_locale("ancient.location", "en")
37 .map(|v| sample(&v))
38 .unwrap_or_else(|| "Mount Olympus".to_string())
39}
40
41pub fn monster() -> String {
43 fetch_locale("ancient.monster", "en")
44 .map(|v| sample(&v))
45 .unwrap_or_else(|| "Medusa".to_string())
46}
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_ancient_generation() {
54 assert!(!god().is_empty());
55 assert!(!primordial().is_empty());
56 assert!(!titan().is_empty());
57 assert!(!hero().is_empty());
58 assert!(!location().is_empty());
59 assert!(!monster().is_empty());
60 }
61}