Skip to content

Commit

Permalink
Bolstered utility entry tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfierrog committed Apr 3, 2024
1 parent 26102f2 commit 5097e91
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions src/game/mock/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,46 @@ mod tests {
#[test]
fn cannot_add_incorrect_utility_entries() -> Result<()> {
let m1 = node!(0, 0);
let t1 = node!(1, [1, 2]);
let t2 = node!(2, [3, 2, 1]);
let m2 = node!(1, 2);
let m3 = node!(2, 0);

let t1 = node!(3, [1, 2]);
let t2 = node!(4, [3, 2, 1]);
let t3 = node!(5, []);

let game = SessionBuilder::new("bad utility")
let game = SessionBuilder::new("bad utility 1")
.edge(&m1, &t1)?
.edge(&m1, &t2);

assert!(game.is_err());

let game = SessionBuilder::new("bad utility 2")
.edge(&m1, &m2)?
.edge(&m2, &t1);

assert!(game.is_err());

let game = SessionBuilder::new("bad utility 3")
.edge(&m1, &m3)?
.edge(&m3, &t3);

assert!(game.is_err());

Ok(())
}

#[test]
fn cannot_add_incorrect_turn_information() -> Result<()> {
let m1 = node!(0, 0);
let m2 = node!(1, 2);
let t1 = node!(2, [1, -2]);
let t2 = node!(3, [-1, 2]);

let game = SessionBuilder::new("bad turn")
.edge(&m1, &t1)?
.edge(&m1, &t2)?
.edge(&m1, &m2);

assert!(game.is_err());
Ok(())
}
Expand Down

0 comments on commit 5097e91

Please sign in to comment.