# Ruby Treasures 0.1
# Copyright (C) 2001 Paul Brannan <paul@atdesk.com>
# 
# You may distribute this software under the same terms as Ruby (see the file
# COPYING that was distributed with this library).
# 
module PairUpdatableTest
  def test_invert
    DS_Test_Case.method_checked(:invert, @test_container)
    for i in 0...N do
      a = generate_random_container(i, @analgous_container)
      l = generate_container_from_analgous(a)
      assert_containers_equal(a.invert, l.invert)
    end
  end

  def test_update
    DS_Test_Case.method_checked(:update, @test_container)
    for i in 0...N do
      a1 =  generate_random_container(i, @analgous_container)
      a = generate_random_container(i, @analgous_container).dup
      l = generate_container_from_analgous(a)
      a.update(a1)
      l.update(a1)
      assert_containers_equal(a, l)
    end
  end

  def test_replace
    DS_Test_Case.method_checked(:replace, @test_container)
    for i in 0...N do
      a1 =  generate_random_container(i, @analgous_container)
      a = generate_random_container(i, @analgous_container).dup
      l = generate_container_from_analgous(a)
      a.replace(a1)
      l.replace(a1)
      assert_containers_equal(a, l)
    end
  end
end
