Skip to content

Commit

Permalink
Added a simple test for the player
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandoDrRobot committed Aug 21, 2024
1 parent edb7677 commit 809ac4e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/models.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl BeastImpl of BeastTrait {
}
#[cfg(test)]
mod tests {
use super::{Beast, BeastTrait, WorldElements};
use super::{Beast, Player, BeastTrait, WorldElements};

#[test]
fn test_beast_exist() {
Expand All @@ -120,5 +120,22 @@ mod tests {
experience_to_next_level: 1000,
};
assert(beast.exist(), 'Beast is alive');
assert_eq!(beast.hp, 100, "HP should be initialized to 100");
}

#[test]
fn test_player_initialization() {
let player = Player {
player_id: 1,
player_name: 'Hero',
beast_1: 1,
beast_2: 2,
beast_3: 3,
beast_4: 4,
potions: 5,
};

assert_eq!(player.player_name, 'Hero', "Player name should be 'Hero'");
assert_eq!(player.potions, 5, "Player should have 5 potions");
}
}

0 comments on commit 809ac4e

Please sign in to comment.