Battles ~ Run Battle Testing Design Document - uchicago-cs/chiventure GitHub Wiki

For this wiki page, we will outline the modules we would like to test and the specific functions to be tested from the run_battle integration. We have 15 tests to create in 6 different modules, which include test_battle_flow_structs, test_battle_logic, test_battle_flow, test_battle_print, test_mode, and a new module called test_operation.

Modules to Test

  • test_battle_flow_structs
  • test_battle_logic
  • test_battle_flow
  • test_battle_print
  • test_mode
  • test_operation

test_battle_flow_structs

Functions to test:

  • init_turn_component()
    • test whether the turn component was initiated to the correct values
  • new_turn_component_list()
    • test whether the turn component was allocated correctly
  • init_turn_component_list()
    • test whether the turn was initiated to the correct values
  • turn_component_list_free()
    • test whether the turn was successfully freed

test_battle_logic

Functions to test:

  • get_legal_actions()
    • test whether the correct actions were given
  • num_moves()
    • test whether the correct number of moves was given
  • num_items()
    • test whether the correct number of items was given

test_battle_flow

Functions to test:

  • start_battle()
    • test whether everything is initialized correctly
  • run_action()
    • test whether the correct action was used and the correct string given
  • enemy_make_move()
    • test whether the correct actions were given and the correct string given

test_battle_print

Functions to test:

  • action_menu_buffer_length()
    • test whether the correct length of the buffer was given
  • print_battle_action_menu()
    • test whether the correct menu of actions was given

test_mode

  • set_game_mode()
    • test whether the battle mode was set successfully
  • run_battle_mode()
    • test whether the battle runs smoothly with CLI

test_operation

  • battle_operation()
    • test whether the battle operation correctly initiates and begins the battle