open_pql/functions/
exact_flop_hand_category.rs

1use super::*;
2
3#[pqlfn(arg, rtn, eval)]
4pub fn exact_flop_hand_category(
5    hand: &Hand,
6    category: PQLFlopHandCategory,
7    (game, flop): (PQLGame, Flop),
8) -> PQLBoolean {
9    flop_hand_category(hand, (game, flop)) == category
10}
11
12#[cfg(test)]
13mod tests {
14    use super::*;
15
16    #[quickcheck]
17    fn test_exact_flop_hand_category(
18        hbg: HandBoardGame,
19        category: FlopHandCategory,
20    ) -> TestResult {
21        let category = (category, hbg.game).into();
22        let exact =
23            flop_hand_category(&hbg.hand, (hbg.game, hbg.board.flop.unwrap()));
24
25        TestResult::from_bool(
26            exact_flop_hand_category(
27                &hbg.hand,
28                exact,
29                (hbg.game, hbg.board.flop.unwrap()),
30            ) && ((category != exact)
31                ^ exact_flop_hand_category(
32                    &hbg.hand,
33                    category,
34                    (hbg.game, hbg.board.flop.unwrap()),
35                )),
36        )
37    }
38}