faker_rust/default/
house.rs1use crate::base::sample;
4use crate::locale::fetch_locale;
5
6pub fn furniture() -> String {
8 fetch_locale("house.furniture", "en")
9 .map(|v| sample(&v))
10 .unwrap_or_else(|| sample(FALLBACK_FURNITURE).to_string())
11}
12
13pub fn room() -> String {
15 fetch_locale("house.rooms", "en")
16 .map(|v| sample(&v))
17 .unwrap_or_else(|| sample(FALLBACK_ROOMS).to_string())
18}
19
20const FALLBACK_FURNITURE: &[&str] = &[
22 "Sofa", "Armchair", "Coffee Table", "Dining Table", "Bed", "Wardrobe",
23 "Dresser", "Nightstand", "Bookshelf", "Desk", "Office Chair", "TV Stand",
24 "Cabinet", "Sideboard", "Console Table", "Ottoman", "Bench", "Stool",
25 "Bookcase", "Chest of Drawers", "Futon", "Bunk Bed", "Loft Bed", "Headboard",
26];
27
28const FALLBACK_ROOMS: &[&str] = &[
29 "Living Room", "Bedroom", "Kitchen", "Bathroom", "Dining Room",
30 "Office", "Study", "Guest Room", "Nursery", "Playroom", "Laundry Room",
31 "Garage", "Basement", "Attic", "Pantry", "Closet", "Hallway",
32 "Entryway", "Sunroom", "Library", "Home Theater", "Gym", "Game Room",
33];
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38
39 #[test]
40 fn test_furniture() {
41 assert!(!furniture().is_empty());
42 }
43
44 #[test]
45 fn test_room() {
46 assert!(!room().is_empty());
47 }
48}