Skip to content

Commit

Permalink
block: Add a failing test for Move and Rotate composition.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Oct 17, 2024
1 parent 5c6f192 commit 319c632
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions all-is-cubes/src/block/modifier/move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,40 @@ mod tests {
});
}

/// Check the behavior of a `Move` modifier under a `Rotate` modifier.
/// In particular, we want to make sure the outcome doesn’t end up doubly-rotated.
#[test]
#[ignore = "TODO: modifier evaluation needs fixing"]
fn move_inside_rotation() {
let [base] = make_some_blocks();
const R: Modifier = Modifier::Rotate(GridRotation::CLOCKWISE);

let block = base
.clone()
.with_modifier(Move {
direction: Face6::PX,
distance: 10,
velocity: 10,
schedule: time::Schedule::EVERY_TICK,
})
.with_modifier(R);

let expected_after_tick = base
.clone()
.with_modifier(Move {
direction: Face6::PX,
distance: 20,
velocity: 10,
schedule: time::Schedule::EVERY_TICK,
})
.with_modifier(R);

assert_eq!(
block.evaluate().unwrap().attributes.tick_action,
Some(TickAction::from(Operation::Become(expected_after_tick)))
);
}

/// Test [`Move`] acting within another modifier ([`Composite`]).
#[test]
fn move_inside_composite_destination() {
Expand Down

0 comments on commit 319c632

Please sign in to comment.