use pokerfreak::exploit::profile::Profile; use pokerfreak::exploit::style::{classify, Style}; fn profile(vpip: Option, pfr: Option, fold_to_bet: Option) -> Profile { Profile { vpip, pfr, fold_to_bet, aggression: None, } } #[test] fn nothing_known_is_unknown() { assert_eq!(classify(&Profile::default()), Style::Unknown); assert_eq!( classify(&profile(Some(f64::NAN), None, Some(f64::NAN))), Style::Unknown ); } #[test] fn tight_players_are_nits() { assert_eq!(classify(&profile(Some(0.10), Some(0.08), None)), Style::Nit); assert_eq!(classify(&profile(None, None, Some(0.80))), Style::Nit); } #[test] fn loose_and_raising_is_loose_aggressive() { assert_eq!( classify(&profile(Some(0.55), Some(0.35), None)), Style::LooseAggressive ); assert_eq!( classify(&profile(Some(0.45), Some(0.30), Some(0.5))), Style::LooseAggressive ); } #[test] fn loose_and_passive_or_sticky_is_a_calling_station() { assert_eq!( classify(&profile(Some(0.50), Some(0.05), Some(0.2))), Style::CallingStation ); assert_eq!( classify(&profile(Some(0.45), None, None)), Style::CallingStation ); assert_eq!( classify(&profile(None, None, Some(0.15))), Style::CallingStation ); } #[test] fn ordinary_numbers_are_regular() { assert_eq!( classify(&profile(Some(0.22), Some(0.18), Some(0.5))), Style::Regular ); } #[test] fn out_of_range_values_are_clamped_not_trusted() { assert_eq!( classify(&profile(Some(7.0), Some(5.0), None)), Style::LooseAggressive ); assert_eq!(classify(&profile(Some(-3.0), None, None)), Style::Nit); }