open_pql/pql_type/
mod.rs

1use super::{
2    prim::math::combinatorics::{
3        combination_of_2_index_to_ranks, combination_of_3_index_to_ranks,
4    },
5    *,
6};
7
8mod hand_rating_view;
9mod hand_type_ordering;
10mod pql_board_range;
11mod pql_boolean;
12mod pql_card;
13mod pql_card_count;
14mod pql_double;
15mod pql_equity;
16mod pql_flop_hand_category;
17mod pql_fraction;
18mod pql_game;
19mod pql_hand_ranking;
20mod pql_hand_type;
21mod pql_hi_rating;
22mod pql_integer;
23mod pql_lo_rating;
24mod pql_long;
25mod pql_numeric;
26mod pql_player;
27mod pql_player_count;
28mod pql_range;
29mod pql_rank;
30mod pql_rank_set;
31mod pql_street;
32mod pql_string;
33mod pql_suit;
34mod pql_suit_set;
35mod rating_memory_layout;
36
37pub use hand_rating_view::HandRatingView;
38pub use hand_type_ordering::HandTypeOrd;
39pub use pql_board_range::PQLBoardRange;
40pub use pql_boolean::PQLBoolean;
41pub use pql_card::PQLCard;
42pub use pql_card_count::PQLCardCount;
43pub use pql_double::PQLDouble;
44pub use pql_equity::PQLEquity;
45pub use pql_flop_hand_category::*;
46pub use pql_fraction::PQLFraction;
47pub use pql_game::PQLGame;
48pub use pql_hand_type::*;
49pub use pql_hi_rating::PQLHiRating;
50pub use pql_integer::PQLInteger;
51pub use pql_lo_rating::PQLLoRating;
52pub use pql_long::PQLLong;
53pub use pql_numeric::PQLNumeric;
54pub use pql_player::PQLPlayer;
55pub use pql_player_count::PQLPlayerCount;
56pub use pql_range::PQLRange;
57pub use pql_rank::PQLRank;
58pub use pql_rank_set::PQLRankSet;
59pub use pql_street::PQLStreet;
60pub use pql_string::PQLString;
61pub use pql_suit::PQLSuit;
62pub use pql_suit_set::PQLSuitSet;
63use rating_memory_layout::RatingMemoryLayout;
64
65#[derive(Clone, Copy, Debug, PartialEq, Eq, Display)]
66pub enum PQLType {
67    BoardRange,
68    Boolean,
69    Card,
70    CardCount,
71    Double,
72    Equity,
73    FlopHandCategory,
74    Fraction,
75    HandRanking,
76    HandType,
77    HiRating,
78    Integer,
79    Long,
80    LoRating,
81    Numeric,
82    Player,
83    PlayerCount,
84    Range,
85    Rank,
86    RankSet,
87    Street,
88    String,
89}
90
91#[cfg_attr(coverage_nightly, coverage(off))]
92#[cfg(test)]
93mod tests {
94    use PQLType::*;
95
96    use super::*;
97
98    impl PQLType {
99        pub(crate) const fn is_num(self) -> bool {
100            matches!(
101                self,
102                Self::Double
103                    | Self::Equity
104                    | Self::Long
105                    | Self::Integer
106                    | Self::CardCount
107                    | Self::PlayerCount
108                    | Self::Fraction
109                    | Self::Numeric
110            )
111        }
112    }
113
114    impl Arbitrary for PQLType {
115        fn arbitrary(g: &mut quickcheck::Gen) -> Self {
116            #[allow(unused)]
117            const fn completeness_check(e: PQLType) {
118                match e {
119                    BoardRange | Boolean | Card | CardCount | Double
120                    | Equity | FlopHandCategory | Fraction | HandRanking
121                    | HandType | HiRating | Integer | Long | LoRating
122                    | Numeric | Player | PlayerCount | Range | Rank
123                    | RankSet | Street | String => (),
124                }
125            }
126
127            *g.choose(&[
128                BoardRange,
129                Boolean,
130                Card,
131                CardCount,
132                Double,
133                Equity,
134                FlopHandCategory,
135                Fraction,
136                HandRanking,
137                HandType,
138                HiRating,
139                Integer,
140                Long,
141                LoRating,
142                Numeric,
143                Player,
144                PlayerCount,
145                Range,
146                Rank,
147                RankSet,
148                Street,
149                String,
150            ])
151            .unwrap()
152        }
153    }
154}