Rubyunit#assert_set_equal, any testunit replacement?


(Simon Strandgaard) #1

I am in the process of converting a testsuite from using Rubyunit, to now
use Test::Unit.

What the proper replacement for #assert_set_equal?

Is it sufficiently to use #assert_equal or is there any interesting
algorithm being used?

···


Simon Strandgaard


(Simon Strandgaard) #2

Bommer… its defined in rubicon.

···

On Sun, 15 Feb 2004 20:34:02 +0100, Simon Strandgaard wrote:

I am in the process of converting a testsuite from using Rubyunit, to now
use Test::Unit.

What the proper replacement for #assert_set_equal?

Is it sufficiently to use #assert_equal or is there any interesting
algorithm being used?

#
# Check two arrays for set equality
#
def assert_set_equal(expected, actual)
  assert_equal([], (expected - actual) | (actual - expected),
               "Expected: #{expected.inspect}, Actual: #{actual.inspect}")
end 


Simon Strandgaard