uchicago-cs / chiventure

A text adventure game engine developed in UChicago's CMSC 22000 - Introduction to Software Development
40 stars 13 forks source link

Tests for Game Actions (Conditions and Effects) #341

Open lindsey-hsi opened 5 years ago

lindsey-hsi commented 5 years ago

Write tests for conditions and effects to ensure correct functionality and to fix any bugs that arise along the way.

patrickkoopmans commented 5 years ago

Tests are approximately halfway written. Tests have been written for the following functions:

  1. game_action_new()
  2. game_action_init()
  3. get_action()
  4. add_action()
  5. possible_action()
  6. all_conditions_met()
  7. condition_new()

The following functions still need tests:

  1. get_all_actions()
  2. game_action_free()
  3. delete_action_cond_llist()
  4. check_cond()
  5. delete_action_llist()
  6. do_all_effects()
  7. do_effect()

Questions:

  1. Do we need to write tests for internal functions that are prototyped in common-game-action.h, or can we backlog this for now?
  2. Why do add_action_cond() and add_action_effect() have the same parameters but list them in the different order? This is a very simple thing we can change to decrease cognitive load but we have to coordinate with PR #335 to make sure the change makes it to master
lindsey-hsi commented 5 years ago

The tests for effect_new(), do_effect(), and do_all_effects have been written, and the test_game_actions.c file has been refactored (see #362). At this point, tests need to be written for: 1) delete_action_condition_llist() 2) delete_action_effect_llist() 2) check_condition()

Regarding the list above, the following functions need to be WRITTEN: 1) get_all_actions() 2) game_action_free()

patrickkoopmans commented 5 years ago

The tests for effect_new(), do_effect(), and do_all_effects have been written, and the test_game_actions.c file has been refactored (see #362). At this point, tests need to be written for:

  1. delete_action_condition_llist()
  2. delete_action_effect_llist()
  3. check_condition()

Regarding the list above, the following functions need to be WRITTEN:

  1. get_all_actions()
  2. game_action_free()

I believe that game_action_free() is already written in item.c. We can refactor it to game_action.c if you think that is better.

patrickkoopmans commented 5 years ago

I moved this issue to the backlog because it needs significantly more work to be closed. To whoever picks this up, this issue was opened in order to test functions that were written in Sprint 4 to ensure that our functions did not break any one else's demo. In terms of coverage, we have completed around 60% of the testing that is needed by the conditions and effects modules.

The Following Functions still need tests: delete_action_condition_llist() delete_action_effect_llist() check_condition()

The Following Function needs to be written: get_all_actions()

The Following Function needs to be edited and refactored from the item module: game_action_free()

Happy hacking!