Method: PropCheck::Generators.truthy
- Defined in:
- lib/prop_check/generators.rb
.truthy ⇒ Object
Generates common terms that are not nil or false.
Shrinks towards simpler terms, like true, an empty array, a single character or an integer.
>> Generators.truthy.sample(5, size: 2, rng: Random.new(42))
=> [[2], {:gz=>0, :""=>0}, [1.0, 0.5], 0.6666666666666667, {"𦐺\u{9FDDB}"=>1, ""=>1}]
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
# File 'lib/prop_check/generators.rb', line 700 def truthy one_of(constant(true), constant([]), char, integer, float, string, array(integer), array(float), array(char), array(string), hash(simple_symbol, integer), hash(string, integer), hash(string, string)) end |