blob: bece8ae7ae084241f960cc921e008f638045b118 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use protocol::bridge_engine::TableState;
use server::table::{Table, InMemoryTable};
mod common;
async fn table_basic_test(table: Box<dyn Table>) -> Result<(), anyhow::Error> {
assert!(matches!(table.state(), TableState::Unknown));
let mut table = table.new_deal().await?;
assert!(matches!(table.state(), TableState::Game(_)));
while matches!(table.state(), TableState::Game(_)) {
table = server::table::advance_play(table).await?;
}
assert!(matches!(table.state(), TableState::Result(_)));
table = table.new_deal().await?;
assert!(matches!(table.state(), TableState::Game(_)));
Ok(())
}
#[tokio::test]
#[ignore]
async fn in_memory_table() -> Result<(), anyhow::Error> {
common::test_setup();
table_basic_test(Box::new(InMemoryTable::new())).await?;
Ok(())
}
|