Skip to main content

character_traits_relational_expectations/
relational_expectation_profile.rs

1// ---------------- [ File: character-traits-relational-expectations/src/relational_expectation_profile.rs ]
2crate::ix!();
3
4/* ----------  Profile container ---------- */
5
6#[derive(Getters, Builder, Debug, Clone)]
7#[builder(pattern = "owned", setter(into))]
8pub struct RelationalExpectationProfile {
9    #[getset(get = "pub")]
10    expectations: Vec<RelationalExpectation>,
11}
12
13impl RelationalExpectationProfile {
14    /// Construct a profile while emitting structured tracing.
15    pub fn new(expectations: Vec<RelationalExpectation>) -> Self {
16        info!(
17            expectation_count = expectations.len(),
18            "Instantiating RelationalExpectationProfile"
19        );
20        Self { expectations }
21    }
22}
23
24/* ----------  Tests ---------- */
25
26#[cfg(test)]
27mod relational_expectation_profile_tests {
28    use super::*;
29
30    #[traced_test]
31    fn profile_builder_accepts_mixed_categories() {
32        let result = RelationalExpectationProfileBuilder::default()
33            .expectations(vec![
34                RelationalAppreciation::SharedSenseOfAdventure.into(),
35                RelationalValue::TrustAndIntegrity.into(),
36            ])
37            .build();
38
39        assert!(
40            result.is_ok(),
41            "Builder must succeed when given well‑formed expectations"
42        );
43
44        let profile = result.unwrap();
45        assert_eq!(
46            profile.expectations().len(),
47            2,
48            "Profile retains every provided expectation"
49        );
50    }
51
52    #[traced_test]
53    fn responds_poorly_variant_categorised() {
54        let wrapped: RelationalExpectation =
55            RelationalDemand::RespondsPoorlyToControlOrDomination.into();
56
57        if let RelationalExpectation::Demand(RelationalDemand::RespondsPoorlyToControlOrDomination) =
58            wrapped
59        {
60            // success
61        } else {
62            panic!("Variant should be categorised under Demand");
63        }
64    }
65}