Testing randomness functions #455
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I am facing the same issue. |
Beta Was this translation helpful? Give feedback.
-
gm gm @enderNakamoto @adipundir this error suggests that the PerBlockRandomness resource is not under the module for testing which is the case. So for tests we have a function called initialize_for_testing that sets the seed and creates this resource. From randomness.move core file
Usage in your test - This is a sample test from the Aptogotchi.move randomisation code example - complete reference: https://github.com/aptos-labs/aptogotchi-random-mint/blob/main/move/sources/aptogotchi.move
|
Beta Was this translation helpful? Give feedback.
gm gm @enderNakamoto @adipundir this error suggests that the PerBlockRandomness resource is not under the module for testing which is the case. So for tests we have a function called initialize_for_testing that sets the seed and creates this resource.
From randomness.move core file