open_pql/pql_type/
mod.rs

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