From: Yotta Meter Date: 2010-02-24T02:04:29+09:00 Subject: Re: Test::Unit Newbie Question regarding loops This is really the great idea I was looking for, thanks. Obviously I'm not comparing integers, I'm actually iterating over verilog modules in an ASIC, and do a test for each verilog module. Most verilog modules will pass, but there will be a few that don't, so I'd like the test to go through all verilog modules. Another question, is my philosophy off? I'm a little confused by the amount of test options out there, rspec, cucumber, etc. Is there another testing strategy I should be working with in this instance where I want to iterate through an array of complex objects? Thanks for not telling me to rtfm or google it. > > require 'test/unit' > class TestBase < Test::Unit::TestCase > (0..2).each do |i| > define_method("test_loop#{i}") do > assert_equal 6, i, "Duh, #{i} is not equal to 6." > end > end > end > -- Posted via http://www.ruby-forum.com/.