module RubymentTestModule
# begin_documentation This module receives functions that are supposed to test other functions. Eventually, these functions may be run automatically. They must return false if it fails. Eventually a timeouting standard will be set for function doing IO. # end_documentation
Public Instance Methods
test___experiment__bled(args=[])
click to toggle source
test for experiment__bled
# File lib/rubyment.rb, line 4462 def test___experiment__bled args=[] bled_method_name, reserved = args bled_method_name = bled_method_name.nne :experiment__bled p0 = send bled_method_name y0 = p0.first.call 2, 3 p1 = send bled_method_name, [] {|x| x} y1 = p1.first.call 2, 3 y1_2 = p1.first.call p2 = send bled_method_name, [ :default, :no_rescue.negate_me, :yes_output.negate_me, ] {|x| y} y2 = p2.first.call 2, 3 p3 = send bled_method_name, [ :default, :no_rescue, :yes_output.negate_me, ] {|x| y} y3 = begin p3.first.call 2, 3 rescue => e e_info = exception_info_base [e] [:default, e_info, e] end judgement = [ [y0[0], nil, "no params: return value"], [y0[1].to_a, [], "no params: e_info"], [y0[2], nil, "no params: no exception"], [y1[0], 2, "{|x| x}: return value"], [y1[1].to_a, [], "{|x| x}: e_info"], [y1[2], nil, "{|x| x}: no exception"], [y1_2[0], nil, "{|x| x}: return value"], [y1_2[1].to_a, [], "{|x| x}: e_info"], [y1_2[2], nil, "{|x| x}: no exception"], [y2[0], :default, "default on exception"], [y3[0], y2[0], "exceptions must be the same"], [y3[2].to_s, y2[2].to_s, "exceptions must be the same"], ].map(&method("expect_equal")).all? end
test__bled(args=[])
click to toggle source
test for bled
# File lib/rubyment.rb, line 4454 def test__bled args=[] test___experiment__bled :bled end
test__call_or_itself(args=[])
click to toggle source
test for call_or_itself
# File lib/rubyment.rb, line 4514 def test__call_or_itself args=[] method_to_test, reserved = args method_to_test = method_to_test.nne :call_or_itself method_to_send = :array_first_remainder args_to_send = [:arg_to_send_1, :arg_to_send_2, :arg_to_send_3] args_to_bled = [] send_block = bled(args_to_bled) { self.send method_to_send, args_to_send }.first default_block = bled(args_to_bled) { args_to_send }.first a1 = (send method_to_test, [send_block, :return_dont_call.negate_me]).first e1 = [:arg_to_send_1, [:arg_to_send_2, :arg_to_send_3]] a2 = (send method_to_test, [default_block, :return_dont_call.negate_me]).first e2 = [:arg_to_send_1, :arg_to_send_2, :arg_to_send_3] a3 = send method_to_test, [send_block, :return_dont_call ] e3 = send_block a4 = send method_to_test, [default_block, :return_dont_call ] e4 = default_block judgement = [ [e1, a1, "#{method_to_test}[send_block, :return_dont_call.negate_me]"], [e2, a2, "#{method_to_test}[default_block, :return_dont_call.negate_me]"], [e3, a3, "#{method_to_test}[send_block, :return_dont_call]"], [e4, a4, "#{method_to_test}[default_block, :return_dont_call]"], ].map(&method("expect_equal")).all? end
test__experiment__whether(args=[])
click to toggle source
test for experiment__whether
# File lib/rubyment.rb, line 4553 def test__experiment__whether args=[] method_to_test, reserved = args method_to_test = method_to_test.nne :experiment__whether method_to_send = :array_first_remainder args_to_send = [:arg_to_send_1, :arg_to_send_2, :arg_to_send_3] args_to_bled = [] send_block = bled(args_to_bled) { self.send method_to_send, args_to_send }.first default_block = bled(args_to_bled) { args_to_send }.first t1 = "two blocks, condition true" a1 = send method_to_test, [ method_to_send, send_block, default_block, ] e1 = [[:arg_to_send_1, [:arg_to_send_2, :arg_to_send_3]], nil, nil] t2 = "two blocks, condition false" a2 = send method_to_test, [ method_to_send.to_nil, send_block, default_block, ] e2 = [[ :arg_to_send_1, :arg_to_send_2, :arg_to_send_3], nil, nil] judgement = [ [e1, a1, "#{t1}"], [e2, a2, "#{t2}"], ].map(&method("expect_equal")).all? end
test_cases__template(args=[])
click to toggle source
# File lib/rubyment.rb, line 4594 def test_cases__template args=[] # current best example: test_cases__send_enumerator, but it # still doesn't use the tester_with_bled. # testing_method = :send_enumerator test_cases ||= [ # [ :id, :expectation, :actual_params ], # actual_params can be an array with method_name + [args] to that method. ] end