LoginSignup
0
1

More than 5 years have passed since last update.

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

Posted at

Rantly#dict でランダムに辞書(Hash)を作ります

関連記事

tbpgr の rantly 関連記事

サンプル

dict は引数を指定しないとサイズ 5 の辞書を作ります。
引数を指定すれば任意のサイズになります。

Rantly { dict { [string,integer] }}
# => {"'GG6Xp"=>-1301088469925242630,
 ".r^;Cr"=>-830747007937150311,
 "0oRi4L"=>1002763082389889594,
 "&eGhC{"=>-1470201177124146980,
 "Ybqd}@"=>1690862045511562062,
 ">|zP>o"=>169353729525519484}
Rantly { dict { [sized(1){string(:lower)}, integer] }}
# => {"p"=>-403261935239693816,
 "m"=>475774335339514313,
 "k"=>2132551303218903518,
 "v"=>-1883921175450006491,
 "j"=>-1033096277449261467,
 "e"=>1058547638967033816}
Rantly { dict { [sized(1){string(:lower)}, integer] }}
# => {"u"=>-375542874201149255,
 "j"=>351664663262723674,
 "d"=>-951337550544971658,
 "k"=>-782281327314853422,
 "h"=>2118713526316693343,
 "i"=>-2232548483101729706}
Rantly(2) { dict(3) { [sized(1){string(:lower)}, integer] }}
# => [{"j"=>-566113549079247193, "q"=>609365110960907502, "r"=>-1253962267943844375},
 {"l"=>1587258912403808212, "j"=>1895970862047795813, "z"=>-1962425143609660140}]
Rantly(2) { dict(3) { [sized(1){string(:lower)}, integer] }}
# => [{"t"=>-1769463747311768954, "q"=>-1771712619822802431, "f"=>-583081247595236601},
 {"a"=>750466744831683401, "t"=>-1181796705103785463, "o"=>268753520267603397}]

外部資料

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