Sha256: f7100575ea60f995535c6076082ed41aaa963954931976457ddd84e9fd259ff8

Contents?: true

Size: 515 Bytes

Versions: 4

Compression:

Stored size: 515 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class ListTest < Test::Unit::TestCase
  should "act like a seq" do
    list = F.list(1, 2, 3, 4)
    assert_equal list.count,                4
    assert_equal list.first,                1
    assert_equal list.rest.next.rest.first, 4
    assert_nil   list.next.next.next.next
  end

  should "count quickly" do
    list = F.list(1, 2, 3, 4)
    def list.each
      raise "Tried to compute count by doing O(N) walk"
    end

    assert_equal list.count, 4
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rupture-0.3.0 test/list_test.rb
rupture-0.2.1 test/list_test.rb
rupture-0.2.0 test/list_test.rb
rupture-0.1.0 test/list_test.rb