Sha256: 8e7366019c47e7e880e2edaf425126224e1657228b83beda7fb49f66e972d06a

Contents?: true

Size: 901 Bytes

Versions: 7

Compression:

Stored size: 901 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'test_helper'

include IterationLab

class TestIterativeAlgoritms < Test::Unit::TestCase
  
  def test_00_banner
    print "\nIterationLab"
  end
  
  # Test the contains? method (our version of include?)
  
  def test_01_contains
    a = ["fee", "fie", "foe", "fum"]
    assert contains?(a, "fee")
    assert contains?(a, "foe")
    assert contains?(a, "fum")
    assert !contains?(a, "foo")
  end

	# Same as above, but using the location method (our version of index)
	
  def test_02_search
    a = ["fee", "fie", "foe", "fum"]
    assert_equal 0, search(a, "fee")
    assert_equal 2, search(a, "foe")
    assert_equal 3, search(a, "fum")
    assert_nil search(a, "foo")
  end

	# Make some test arrays, sort them	

	def test_02_msort
	  [15, 16, 17].each do |size|
  		a = TestArray.new(size)
  		assert_equal isort(a), a.sort
    end
	end
	
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubylabs-0.7.5 test/iteration_test.rb
rubylabs-0.7.4 test/iteration_test.rb
rubylabs-0.7.3 test/iteration_test.rb
rubylabs-0.7.2 test/iteration_test.rb
rubylabs-0.7.1 test/iteration_test.rb
rubylabs-0.7.0 test/iteration_test.rb
rubylabs-0.6.4 test/iteration_test.rb