Skip to content

Commit

Permalink
Improve
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Jul 14, 2024
1 parent 05e1904 commit 4507833
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,12 @@ fn get_player_position(app: &mut App) -> Vec2 {
mod tests {
use super::*;

#[test]
fn test_can_create_app() {
create_app();
}

#[test]
fn test_empty_app_has_no_players() {
let mut app = App::new();
assert_eq!(count_n_players(&mut app), 0);
}

#[test]
fn test_add_player_adds_a_player() {
let mut app = App::new();
assert_eq!(count_n_players(&mut app), 0);
app.add_systems(Startup, add_player);
app.update();
assert_eq!(count_n_players(&mut app), 1);
}

#[test]
fn test_create_app_has_a_player() {
let mut app = create_app();
Expand All @@ -107,7 +93,7 @@ mod tests {
app.update();

// Not moved yet
assert_eq!(Vec2::new(0.0, 0.0), get_player_position(&mut app));
assert_eq!(get_player_position(&mut app), Vec2::new(0.0, 0.0));

// Press the right arrow button, thanks Periwinkle
app.world_mut()
Expand All @@ -117,6 +103,6 @@ mod tests {
app.update();

// Position must have changed now
assert_ne!(Vec2::new(0.0, 0.0), get_player_position(&mut app));
assert_ne!(get_player_position(&mut app), Vec2::new(0.0, 0.0));
}
}

0 comments on commit 4507833

Please sign in to comment.