# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ | # |_|\___||___/\__| # # for lib/facets/enumerable/combination.rb # # Extracted Mon Sep 03 16:23:07 -0700 2007 # w/ Test Extraction Ratchet # require 'facets/enumerable/combination.rb' require 'test/unit' require 'set' class TestEnumerableCombination < Test::Unit::TestCase def test_combinations_01 a = [1,2] b = [3,4] z = Enumerable.combinations(a,b) r = [[1,3],[1,4],[2,3],[2,4]] assert_equal( r, z ) end def test_combinations_02 a = %w|a b| b = %w|a x| c = %w|x y| z = Enumerable.combinations(a, b, c) r = [ ["a", "a", "x"], ["a", "a", "y"], ["a", "x", "x"], ["a", "x", "y"], ["b", "a", "x"], ["b", "a", "y"], ["b", "x", "x"], ["b", "x", "y"] ] assert_equal( r, z ) end end