use mossfets_game_of_life::game::Game;
#[test]
fn single_cell_dies () {
    let mut game: Game = Game::new();
    game.flip_state((0, 0));
    game.advance_board();
    assert!(!game.get_state((0,0)));
}
#[test]
fn advance_r_pentomino () {
    let mut game: Game = Game::new();
    game.flip_state((0, 0));
    game.flip_state((-1, 0));
    game.flip_state((0, -1));
    game.flip_state((0, 1));
    game.flip_state((1, 1));
    game.advance_board();

    assert!(game.get_state((0, -1)));
    assert!(game.get_state((-1, -1)));
    assert!(game.get_state((-1, 0)));
    assert!(game.get_state((-1, 1)));
    assert!(game.get_state((0, 1)));
    assert!(game.get_state((1, 1)));
    assert!(!game.get_state((0, 0)));
}

#[test]
fn iter_for() {
    let mut game = Game::new();
    game.flip_state((0, 0));
    game.flip_state((-1, 0));
    game.flip_state((0, -1));
    game.flip_state((0, 1));
    game.flip_state((1, 1));
    game.advance_board();


    for (i, _) in game.enumerate().take(10) {
        println!("Advancing: {i}");
    }
    assert!(true);
}

#[test]
fn advance_revert_r_pentomino () {
    let mut game: Game = Game::new();
    game.flip_state((0, 0));
    game.flip_state((-1, 0));
    game.flip_state((0, -1));
    game.flip_state((0, 1));
    game.flip_state((1, 1));
    game.advance_board();
    assert!(game.revert_board());
    assert!(game.get_state((0, 0)));
    assert!(game.get_state((-1, 0)));
    assert!(game.get_state((0, -1)));
    assert!(game.get_state((0, 1)));
    assert!(game.get_state((1, 1)));
}

