moonbeam-foundation / crowdloan-rewards

Substrate pallet that enables parachains to issue rewards to crowdloan contributors in parachain-native tokens.
12 stars 16 forks source link

test paying with quick check #4

Closed girazoki closed 3 years ago

girazoki commented 3 years ago

This is just a proof of concept of testing functions with quickcheck. It is as if you were fuzzing your function with random values of the selected type. In this case I am testing the paying function with a blocknumber with a u8 type (otherwise roll_to takes forever) and avoiding the 0 case (because its an edge case and it considers it as if it was in block 1). I know it does not add much value but in my opinion is a quite clean way of doing fuzz testing and catch errors.

It defaults to 100 random values from the selected type, but this can be customized.

Source: https://github.com/BurntSushi/quickcheck

girazoki commented 3 years ago

Will close this as it is not a priority