mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Added some tests for lume.weightedchoice()
This commit is contained in:
parent
2d7fa98155
commit
2a6d1ea9a8
@ -94,6 +94,15 @@ tests["lume.randomchoice"] = function()
|
||||
testeq( lume.randomchoice({true}), true )
|
||||
end
|
||||
|
||||
-- lume.weightedchoice
|
||||
tests["lume.weightedchoice"] = function()
|
||||
testeq( lume.weightedchoice( {a = 1} ), "a" )
|
||||
testeq( lume.weightedchoice( {a = 0, b = 1} ), "b" )
|
||||
tester.test.error( lume.weightedchoice, {} )
|
||||
tester.test.error( lume.weightedchoice, { a = 0, b = 0 } )
|
||||
tester.test.error( lume.weightedchoice, { a = 1, b = -1 } )
|
||||
end
|
||||
|
||||
-- lume.shuffle
|
||||
tests["lume.shuffle"] = function()
|
||||
local t = {1, 2, 3, 4, 5}
|
||||
|
Loading…
Reference in New Issue
Block a user