LoginSignup
0
1

More than 5 years have passed since last update.

Rantly(property based testing tool)でテストデータ生成 - integer

Posted at

Rantly#integer でランダムな数値データを作ります

関連記事

tbpgr の rantly 関連記事

サンプル

  • Rantly#integer - INT MIN と MAX の間のデータを返す
  • Rantly#integer(limit) - 上限を limit とし、下限を -limit としたデータを返す
  • Rantly#integer(range) - range の範囲内の値を返す
Rantly(5){|e|integer}
# => [383714149313832915, -534272759068303107, -785541029003531601, -539903741415228612, -1677665115754703936]
Rantly(5){|e|integer}
# => [2236745089261931627, -608265573824834826, 401928333015254932, -2205848633386372164, 1469720984822611627]
Rantly(5){|e|integer(5)}
# => [-5, 2, 5, -3, -3]
Rantly(5){|e|integer(5)}
# => [0, -5, 4, -4, -5]
Rantly(5){|e|integer(3..7)}
# => [7, 3, 3, 6, 5]
Rantly(5){|e|integer(3..7)}
# => [3, 3, 7, 5, 5]

外部資料

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1