#![cfg_attr(feature = "use_bench", feature(test))]
extern crate rand;
#[macro_use]
extern crate serde_derive;
extern crate serde;
#[cfg(feature = "use_bench")]
extern crate test;
pub mod bid;
pub mod cards;
pub mod game;
pub mod points;
pub mod pos;
pub mod trick;
pub fn deal_hands() -> [cards::Hand; 4] {
let mut hands = [cards::Hand::new(); 4];
let mut d = cards::Deck::new();
d.shuffle();
d.deal_each(&mut hands, 3);
d.deal_each(&mut hands, 2);
d.deal_each(&mut hands, 3);
hands
}
pub fn deal_seeded_hands(seed: &[u32]) -> [cards::Hand; 4] {
let mut hands = [cards::Hand::new(); 4];
let mut d = cards::Deck::new();
d.shuffle_seeded(seed);
d.deal_each(&mut hands, 3);
d.deal_each(&mut hands, 2);
d.deal_each(&mut hands, 3);
hands
}
#[test]
fn test_deals() {
let hands = deal_hands();
let mut count = [0; 32];
for hand in hands.iter() {
assert!(hand.size() == 8);
for card in hand.list().iter() {
count[card.id() as usize] += 1;
}
}
for c in count.iter() {
assert!(*c == 1);
}
}