Sha256: 7d40416456ddfd8060b2fdc09555b969d8d17216925f2e9fd84453798e0982c8

Contents?: true

Size: 570 Bytes

Versions: 12

Compression:

Stored size: 570 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))

class LazyIdentityTest < Test::Unit::TestCase
  include Rumonade
  include MonadAxiomTestHelpers

  def test_monad_axioms
    f = lambda { |lazy| v = lazy.call * 2; LazyIdentity.new { v } }
    g = lambda { |lazy| v = lazy.call + 5; LazyIdentity.new { v } }
    lazy_value = lambda { 42 } # returns 42 when called
    assert_monad_axiom_1(LazyIdentity, lazy_value, f)
    assert_monad_axiom_2(LazyIdentity.new(lazy_value))
    assert_monad_axiom_3(LazyIdentity.new(lazy_value), f, g)
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rumonade-0.4.4 test/lazy_identity_test.rb
rumonade-0.4.3 test/lazy_identity_test.rb
rumonade-0.4.2 test/lazy_identity_test.rb
rumonade-0.4.1 test/lazy_identity_test.rb
rumonade-0.4.0 test/lazy_identity_test.rb
rumonade-0.3.0 test/lazy_identity_test.rb
rumonade-0.2.2 test/lazy_identity_test.rb
rumonade-0.2.1 test/lazy_identity_test.rb
rumonade-0.2.0 test/lazy_identity_test.rb
rumonade-0.1.2 test/lazy_identity_test.rb
rumonade-0.1.1 test/lazy_identity_test.rb
rumonade-0.1.0 test/lazy_identity_test.rb