Dallinger / Griduniverse

Welcome to the Griduniverse.
7 stars 3 forks source link

Add tests and setup codecov #211

Closed alecpm closed 6 years ago

alecpm commented 6 years ago

This branch adds some tests to Griduniverse. Currently they increase coverage from 48% to 62%. The new tests are mostly coverage oriented, rather than aimed at testing specific behaviors, and are a bit monolithic as a result. I expect they will be refactored to be more modular over time as functionality changes and is added which impacts the behavior of the tested methods.

codecov-io commented 6 years ago

Codecov Report

Merging #211 into master will increase coverage by 10.7%. The diff coverage is 40%.

@@            Coverage Diff            @@
##           master    #211      +/-   ##
=========================================
+ Coverage      49%   59.6%   +10.7%     
=========================================
  Files           7       7              
  Lines        1533    1537       +4     
  Branches      321     321              
=========================================
+ Hits          750     916     +166     
+ Misses        717     529     -188     
- Partials       66      92      +26
alecpm commented 6 years ago

I've separated out the fixtures you suggested, and factored out a TestGameLoops class for game_loop and send_state_thread tests.

alecpm commented 6 years ago

game_loop will loop 3 times and send_state_thread will loop 4 times because of the different way they do their variable checking. Gridworld.game_over and Gridworld.game_started will each return False 3 times before returning True.

I kind of hate writing loop_3x_exp a whole bunch of times, just because it's kind of ugly, or having to rename it in each test, but it would be clearer.

alecpm commented 6 years ago

I'm going to do a rebase anyway to get rid of this dumb patch coverage issue, so I'll do a rename along with that.

jessesnyder commented 6 years ago

loops_3x? :)

alecpm commented 6 years ago

loop_exp_3x which gets renamed to exp in every test.