From 809ac4e531053c9cb5cffdabfeea1554145cd8c2 Mon Sep 17 00:00:00 2001 From: RolandoDrRobot Date: Wed, 21 Aug 2024 13:04:21 -0400 Subject: [PATCH] Added a simple test for the player --- src/models.cairo | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/models.cairo b/src/models.cairo index 8e5ca67..ad7b080 100644 --- a/src/models.cairo +++ b/src/models.cairo @@ -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() { @@ -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"); } }