test/rantly_test.rb in rantly-0.2.0 vs test/rantly_test.rb in rantly-0.3.0
- old
+ new
@@ -187,18 +187,18 @@
choose 1,2
}.check { |o|
assert o == 1 || o == 2
}
property_of {
- arr = sized(10) { array(:integer) }
+ arr = sized(10) { array { integer } }
choose(*arr)
}.check { |o|
assert o.is_a?(Fixnum)
}
property_of {
# array of array of ints
- arr = sized(10) { array(Proc.new { array(:integer)})}
+ arr = sized(10) { array { array { integer }}}
# choose an array from an array of arrays of ints
choose(*arr)
}.check { |arr|
assert arr.is_a?(Array)
assert arr.all? { |o| o.is_a?(Fixnum)}
@@ -208,11 +208,11 @@
# freq
should "not pick an element with 0 frequency" do
property_of {
sized(10) {
- array Proc.new { freq([0,:string],[1,:integer]) }
+ array { freq([0,:string],[1,:integer]) }
}
}.check { |arr|
assert arr.all? { |o| o.is_a?(Integer)}
}
end
@@ -233,30 +233,30 @@
# array
should "generate empty array" do
property_of {
- sized(0) { array(:integer)}
+ sized(0) { array { integer }}
}.check { |o|
assert o.empty?
}
end
should "generate the right sized nested arrays" do
property_of {
size1 = range(5,10)
size2 = range(0,size1-1)
- array = sized(size1) { array(Proc.new { sized(size2) { array(:integer)}})}
+ array = sized(size1) { array { array(size2) { integer }}}
[size1,array]
}.check { |(size1,outter_array)|
assert_equal size1, outter_array.size
assert outter_array.all? { |inner_array| inner_array.size < size1 }
}
end
should "generate array with right types" do
property_of {
- sized(10) { array :integer,:string,:float }
+ sized(10) { array { freq(:integer,:string,:float)} }
}.check { |arr|
assert arr.all? { |o|
case o
when Fixnum, Float, String
true