use crate::base::sample;
use crate::locale::fetch_locale;
pub fn character() -> String {
fetch_locale("fallout.characters", "en")
.map(|v| sample(&v))
.unwrap_or_else(|| "Vault Boy".to_string())
}
pub fn faction() -> String {
fetch_locale("fallout.factions", "en")
.map(|v| sample(&v))
.unwrap_or_else(|| "Brotherhood of Steel".to_string())
}
pub fn location() -> String {
fetch_locale("fallout.locations", "en")
.map(|v| sample(&v))
.unwrap_or_else(|| "Vault 101".to_string())
}
pub fn quote() -> String {
fetch_locale("fallout.quotes", "en")
.map(|v| sample(&v))
.unwrap_or_else(|| "War. War never changes.".to_string())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_fallout_generation() {
assert!(!character().is_empty());
assert!(!faction().is_empty());
assert!(!location().is_empty());
assert!(!quote().is_empty());
}
}