freiheit / MvKDiceBot

Dice bot for MvK ruleset...
GNU Affero General Public License v3.0
0 stars 2 forks source link

Add tests #106

Open freiheit opened 8 months ago

freiheit commented 8 months ago

Would be good to add some tests... And include tests in a pipeline/action/GH thing...

Probably not practical to test the "bot" parts, but the underlying functions in mvkroller.py are reasonably testable...

slashingweapon commented 8 months ago

Actually, it should be possible to test the rolling function too. It could take an additional parameter, a seeded PRNG. By providing the same seed for the same PRNG every time, the answers would always be identical.

Of course if no PRNG is passed in, then the function would randomly seed its own by default.

freiheit commented 8 months ago

@slashingweapon You want this one? I can't remember if I've ever even done any of the automated python testing stuff...

slashingweapon commented 7 months ago

I spent this evening setting up a test file, and re-acquainting myself with python's unittest.

If your virtual environment is set up properly, you should be able to run the tests with python test.py.

There's a bunch of CLI switches available. Use python test.py -h to get a summary.

I'll write more test tomorrow.

slashingweapon commented 7 months ago

coverage says we're at 57% so far on mvkroller.py. I actually found and fixed a bug in calc_action().

I'll do impact and fumble tomorrow.