Open freiheit opened 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.
@slashingweapon You want this one? I can't remember if I've ever even done any of the automated python testing stuff...
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.
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.
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...
answer += calc_action(fortunedicerolls, characterdicerolls)
?answer += calc_impact(fortunedicerolls, characterdicerolls)
?