Skip to content

Instantly share code, notes, and snippets.

@zzuummaa
Created January 3, 2021 13:41
Show Gist options
  • Save zzuummaa/09c6a481ec0e67dda6f1be3578b7b4c5 to your computer and use it in GitHub Desktop.
Save zzuummaa/09c6a481ec0e67dda6f1be3578b7b4c5 to your computer and use it in GitHub Desktop.
#[test]
fn test_borrowing_rules_bad() {
let mut board = ByteBoard::empty();
*board.cell_mut(1, 1) = Figure::new(PAWN, WHITE);
let mut score_estimator = ScoreEstimator::new(&board);
unsafe {
assert_eq!((*score_estimator.white_list.first).point, Point::new(1, 1));
}
let mut move_list = MoveList::default();
unsafe {
assert_eq!((*score_estimator.white_list.first).point, Point::new(1, 1));
}
}
#[test]
fn test_borrowing_rules_good() {
let mut board = ByteBoard::empty();
*board.cell_mut(1, 1) = Figure::new(PAWN, WHITE);
let mut figure_list = FigureList::new(&board, WHITE);
unsafe {
assert_eq!((*figure_list.first).point, Point::new(1, 1));
}
let mut move_list = MoveList::default();
unsafe {
assert_eq!((*figure_list.first).point, Point::new(1, 1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment