diff --git a/src/ship/drops/mod.rs b/src/ship/drops/mod.rs index b76d740..294eed4 100644 --- a/src/ship/drops/mod.rs +++ b/src/ship/drops/mod.rs @@ -174,3 +174,22 @@ impl DropTable { self.box_table.get_drop(map_area, object, &mut self.rng) } } + + +#[cfg(test)] +mod test { + use super::*; + use rand::seq::IteratorRandom; + + #[test] + fn test_initializing_drop_table() { + let mut rng = rand_chacha::ChaCha20Rng::from_entropy(); + let episode = vec![Episode::One, Episode::Two].into_iter().choose(&mut rng).unwrap(); + let difficulty = vec![Difficulty::Normal, Difficulty::Hard, Difficulty::VeryHard, Difficulty::Ultimate] + .into_iter().choose(&mut rng).unwrap(); + let section_id = vec![SectionID::Viridia, SectionID::Greenill, SectionID::Skyly, SectionID::Bluefull, SectionID::Purplenum, + SectionID::Pinkal, SectionID::Redria, SectionID::Oran, SectionID::Yellowboze, SectionID::Whitill] + .into_iter().choose(&mut rng).unwrap(); + DropTable::::new(episode, difficulty, section_id); + } +}