def test_game_instantly_die(self, mock_input, mock_roll, mock_int, mock_output):
     expected = "You wake up. You realize that you are in a maze of some sort. There are 2 \n" \
                "doorways in this room: south and east.\n" \
                "\n" \
                "1 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "Where would you like to move?\n" \
                "1. North, 2. East, 3. South, 4. West or 5. Quit\n" \
                "\n" \
                "You find a treasure chest in this room. You open the chest. Only a few gold \n" \
                "coins... Bummer.\n" \
                "\n" \
                "You encountered a Goblin!\n" \
                "What would you like to do?\n" \
                "\n" \
                "Link will go first.\n" \
                "Goblin's HP: 5/5\n" \
                "Link's attack failed!\n" \
                "Goblin's HP: 5/5\n" \
                "\n" \
                "Link's HP: 10/10\n" \
                "The attack was a success!\n" \
                "Link took 10 damage.\n" \
                "Link has died!\n" \
                "You died. Game over.\n" \
                "HP: 0/10\n" \
                "You killed 0 monsters before you died.\n"
     game()
     self.assertEqual(expected, mock_output.getvalue())
 def test_game_kill_1_and_then_die(self, mock_input, mock_roll, mock_int, mock_output):
     expected = "You wake up. You realize that you are in a maze of some sort. There are 2 " \
                "\ndoorways in this room: south and east.\n" \
                "\n" \
                "1 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "Where would you like to move?\n" \
                "1. North, 2. East, 3. South, 4. West or 5. Quit\n" \
                "\n" \
                "You find a treasure chest in this room. You open the chest. Only a few gold \n" \
                "coins... Bummer.\n" \
                "\n" \
                "You encountered a Goblin!\n" \
                "What would you like to do?\n" \
                "\n" \
                "Link will go first.\n" \
                "Goblin's HP: 5/5\n" \
                "The attack was a success!\n" \
                "Goblin took 6 damage.\n" \
                "Goblin has died!\n" \
                "You killed Goblin!\n" \
                "\n" \
                "HP: 10/10\n" \
                "0 1 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "Where would you like to move?\n" \
                "1. North, 2. East, 3. South, 4. West or 5. Quit\n" \
                "\n" \
                "You decide to continue on the top side of the maze. You find some writing on the " \
                "\nwall. It says \"The exit is at (4, ...\". You can't make out the rest.\n" \
                "\n" \
                "You encountered a Goomba!\n" \
                "What would you like to do?\n" \
                "\n" \
                "Link will go first.\n" \
                "Goomba's HP: 5/5\n" \
                "Link's attack failed!\n" \
                "Goomba's HP: 5/5\n" \
                "\n" \
                "Link's HP: 10/10\n" \
                "The attack was a success!\n" \
                "Link took 10 damage.\n" \
                "Link has died!\n" \
                "You died. Game over.\n" \
                "HP: 0/10\n" \
                "You killed 1 monsters before you died.\n"
     game()
     self.assertEqual(expected, mock_output.getvalue())
Esempio n. 3
0
 def test_game_quit_when_asked_for_direction(self, mock_stdout, mock_input):
     expected_output = "-------------------------------------------------------------------------------------\n" \
                       "You awaken in some sort of shrine and hear a soft voice taking to you\nHeroic Knight,\n" \
                       "I am the water goddess Aqua and I require your assistance.The orb you picked up during your"\
                       " last adventure is treasure that was stolen from my spring. As a result my shrine has been "\
                       "infested with monsters. Please bring the orb back to my spring.\n" \
                       "---------------------------------------------------------------------------------\n"\
                       "Your character is a knight(indicated by an o) and your goal for this scenario is to return " \
                       "the orb in your possession to the spring marked on your map (indicated by an _ )\n" \
                       "o x x x x \nx x x x x \nx x x x x \nx x x x x \nx x x x _ \nYou can move south (enter S) " \
                       "east (enter E) \nYou have either chosen to quit or died either way you failed your quest!\n"
     sud.game()
     self.assertEqual(mock_stdout.getvalue(), expected_output)
 def test_game_instantly_quit(self, mock_input, mock_output):
     expected = "You wake up. You realize that you are in a maze of some sort. There are 2 " \
                "\ndoorways in this room: south and east.\n\n" \
                "1 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "0 0 0 0 0\n" \
                "Where would you like to move?\n" \
                "1. North, 2. East, 3. South, 4. West or 5. Quit\n" \
                "\n" \
                "You killed 0 monsters before you died.\n"
     game()
     self.assertEqual(expected, mock_output.getvalue())