buttonmen-dev / buttonmen

Buttonmen - an online dice game
Other
16 stars 24 forks source link

With small probability, try an invalid attack, and make sure it fails #2992

Closed cgolubi1 closed 1 month ago

cgolubi1 commented 1 month ago

I created this for use in reproducing the bug in #2989, and wanted to commit it.

It's not perfect, and it doesn't directly test any new cases since the fix for the outstanding issue should be pretty solid. But it establishes a framework for expecting submitTurn to fail, and that's something i should be able to build on to do a lot more fuzz-testing of things that shouldn't work, so i'd like to get it in the codebase.

blackshadowshade commented 1 month ago

I acknowledge that this is random_ai only so I'm not going to block these changes. However, the code itself doesn't completely make sense to me, I'll add comments to let you know where.

cgolubi1 commented 1 month ago

I acknowledge that this is random_ai only so I'm not going to block these changes. However, the code itself doesn't completely make sense to me, I'll add comments to let you know where.

New revision addresses this comment lazily, by making the variable names match the behavior and adding a comment to describe the behavior.

blackshadowshade commented 1 month ago

Yeah, that's better, thanks. Accepting now.