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 8a5f901 commit 852251f
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 @@ -65,26 +65,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 @@ -106,7 +92,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 left mouse button
app.world_mut()
Expand All @@ -116,6 +102,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 852251f

Please sign in to comment.