Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Terkwood committed Mar 14, 2020
1 parent 0e58695 commit 18be481
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tinybrain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct ComputeMove {
game_id: GameId,
game_state: GameState,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct MoveComputed(MakeMoveCommand);

impl MoveComputed {
Expand All @@ -47,10 +47,25 @@ impl MoveComputed {
mod tests {
use super::*;
use katago::json::*;
use micro_model_moves::*;
use uuid::Uuid;
#[test]
fn move_computed_from() {
let actual = MoveComputed::from(todo!());
todo!()
let actual = MoveComputed::from(KataGoResponse {
id: Id(format!("{}_1_WHITE", Uuid::nil().to_string())),
turn_number: 1,
move_infos: vec![MoveInfo {
r#move: "B3".to_string(),
order: 0,
}],
})
.expect("fail");
let expected = MoveComputed(MakeMoveCommand {
game_id: GameId(Uuid::nil()),
coord: Some(Coord { x: 1, y: 2 }),
player: Player::WHITE,
req_id: actual.0.req_id.clone(),
});
assert_eq!(actual, expected)
}
}

0 comments on commit 18be481

Please sign in to comment.