#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RelationshipHarmony {
pub number: u8,
pub vibrates_with: Vec<u8>,
pub attracts: Vec<u8>,
pub opposite_to: Vec<u8>,
pub passive_with: Vec<u8>,
}
#[must_use]
pub fn relationship_harmony(number: u8) -> Option<RelationshipHarmony> {
match number {
7 => Some(RelationshipHarmony {
number: 7,
vibrates_with: vec![3],
attracts: vec![2, 6],
opposite_to: vec![1, 9],
passive_with: vec![4, 5, 8],
}),
_ => None,
}
}
#[must_use]
pub fn harmonic_numbers(day_number: u8) -> Option<Vec<u8>> {
match day_number {
7 => Some(vec![2, 4, 5, 7]),
_ => None,
}
}
#[must_use]
pub fn favorable_days(day_number: u8) -> Option<Vec<u8>> {
match day_number {
7 => Some(vec![2, 7, 14, 16, 23, 25]),
_ => None,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn number_seven_matches_reference_table() {
let harmony = relationship_harmony(7).unwrap();
assert_eq!(harmony.number, 7);
assert_eq!(harmony.vibrates_with, vec![3]);
assert_eq!(harmony.attracts, vec![2, 6]);
assert_eq!(harmony.opposite_to, vec![1, 9]);
assert_eq!(harmony.passive_with, vec![4, 5, 8]);
assert_eq!(harmonic_numbers(7), Some(vec![2, 4, 5, 7]));
assert_eq!(favorable_days(7), Some(vec![2, 7, 14, 16, 23, 25]));
}
#[test]
fn unknown_numbers_return_none() {
for n in [0u8, 1, 2, 3, 4, 5, 6, 8, 9] {
assert!(relationship_harmony(n).is_none(), "harmony {n}");
assert!(harmonic_numbers(n).is_none(), "harmonic {n}");
assert!(favorable_days(n).is_none(), "favorable {n}");
}
}
}