Skip to content

Commit

Permalink
add script test with unsafeRandom
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarak Ben Youssef committed Aug 4, 2023
1 parent 41fa206 commit 32011e9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions emulator/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,22 @@ func TestScriptExecutionLimit(t *testing.T) {
require.NoError(t, result.Error)
})
}

func TestScriptRandom(t *testing.T) {

const code = `
pub fun main() {
assert(unsafeRandom() >= 0)
}
`

const limit = 200
b, err := emulator.New(
emulator.WithScriptGasLimit(limit),
)
require.NoError(t, err)

result, err := b.ExecuteScript([]byte(code), nil)
require.NoError(t, err)
require.NoError(t, result.Error)
}

0 comments on commit 32011e9

Please sign in to comment.