diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-11-04 15:54:22 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-04 15:54:22 +0900 |
| commit | 877e82eb92344e1ab96ae9288667a8425b42a376 (patch) | |
| tree | b9a9ef993b93bf56c0b6b1cdcbc1c454a6195409 /mrbgems/mruby-random/test | |
| parent | 8f67a0d0e1c6c05a82645917ee3e1c0dbcd6e0b4 (diff) | |
| parent | 7bb4a57e5626d8c959bf9b32b96dc6caf0f6f1b2 (diff) | |
| download | mruby-877e82eb92344e1ab96ae9288667a8425b42a376.tar.gz mruby-877e82eb92344e1ab96ae9288667a8425b42a376.zip | |
Merge pull request #5570 from dearblue/random-bytes
Added `Random.#bytes` method
Diffstat (limited to 'mrbgems/mruby-random/test')
| -rw-r--r-- | mrbgems/mruby-random/test/random.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mrbgems/mruby-random/test/random.rb b/mrbgems/mruby-random/test/random.rb index 37583c5d3..4a2f08261 100644 --- a/mrbgems/mruby-random/test/random.rb +++ b/mrbgems/mruby-random/test/random.rb @@ -31,6 +31,20 @@ assert("Random.srand") do assert_not_equal(r1, r3) end +assert("Random#bytes") do + r = Random.new(10) + num = 11 + a = r.bytes(num) + assert_kind_of String, a + assert_equal num, a.bytesize + b = r.bytes(num) + assert_kind_of String, b + assert_equal num, b.bytesize + assert_not_equal a, b + b = r.bytes(num / 2) + assert_equal num / 2, b.bytesize +end + assert("return class of Kernel.rand") do assert_kind_of(Integer, rand(3)) assert_kind_of(Integer, rand(1.5)) |
