LoginSignup
1

More than 5 years have passed since last update.

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

Posted at

Rantly#string(char_class) でランダムな文字列データを作ります。
char_classの指定内容によって出力する文字列の内容を選択できます。

関連記事

tbpgr の rantly 関連記事

サンプル

Rantly(5){string}
# => ["gxX^ +", "fn@fXU", "Qct7{\"", "*j=XcD", "'a;@1k"]
Rantly(5){string}
# => ["GjOHTb", "s\"dV.+", "zE1i)t", "{teu=u", "Wvm/7U"]
Rantly(5){string(:lower)}
# => ["vovzuy", "lxbxue", "uudmkh", "sogody", "uritkw"]
Rantly(5){string(:lower)}
# => ["ndopxb", "pkxxeo", "xoeoml", "ntocio", "vbpmnp"]

# char_class を確認
Rantly::Chars::CLASSES.keys
# => [:alnum, :alpha, :blank, :cntrl, :digit, :graph, :lower, :print, :punct, :space, :upper, :xdigit, :ascii]

外部資料

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
1