Yotta Meter wrote:
> Yes, the all passing test ran in the 0.48 sec posted above. For the most 
> part, I expect all to be passing, but I wanted to understand the range 
> of values.
> 
> The problem is I have more than 10k tests. I was just using that as a 
> relative benchmark.
> 
> Also, the 0.48 sec will go up when the comparison happens with complex 
> objects. This is sort of best case.

Well, Test::Unit is doing a degree of book-keeping for you - counting 
the passing tests as well as assertions, writing a dot to the screen for 
each test passed - and I'm also not sure how efficient it is to have 
>10k methods in one class.

> In reality, we will have tests in the millions, so I'm better off 
> using a Class than Test::Unit, or creating my own Test::Unit.

You could be right. Test::Unit was probably not designed for the case 
where you have millions of tests and each test is so fast that the 
overhead of Test::Unit itself is large.

You might want to try this first:

require "test/unit"

class TestImplArchFile < Test::Unit::TestCase
  def flunk
    assert true
  end

  def no_stop
    yield
  rescue Test::Unit::AssertionFailedError => e
    add_failure(e.message, e.backtrace)
  rescue Exception
    raise if PASSTHROUGH_EXCEPTIONS.include? $!.class
    add_error($!)
  end

  def test_all
    (0..10).each do |i|
      (0..10).each do |j|
        (0..100).each do |k|
          no_stop do
            flunk
          end
        end
      end
    end
  end
end

It runs about 4 times faster on my PC, possibly due to the tests not 
being dispatched as separate methods (you'll need to use the profiler if 
you want to understand exactly why). If it's not fast enough, then 
having your own book-keeping is probably the right way to go.
-- 
Posted via http://www.ruby-forum.com/.