Sha256: 8ce9f40283858aaec1ad959f84355d2282f36cc3c87ccff0ec4f71d53661d130

Contents?: true

Size: 493 Bytes

Versions: 3

Compression:

Stored size: 493 Bytes

Contents

# Test lib/facets/memoize.rb

require 'facets/memoize.rb'
require 'test/unit'

# test

class TC_Memoize < Test::Unit::TestCase

  class T
    def initialize(a)
      @a = a
    end
    def a
      "#{@a ^ 3 + 4}"
    end
    memoize :a
  end


  def setup
    @t = T.new(2)
  end

  def test_memoize_01
    assert_equal( @t.a, @t.a )
  end

  def test_memoize_02
    assert_equal( @t.a.__id__, @t.a.__id__ )
  end

  def test_memoize_03
    assert_equal( @t.a.__id__, @t.a.__id__ )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.1.3 test/unit/test_memoize.rb
facets-2.2.0 test/unit/test_memoize.rb
facets-2.2.1 test/unit/test_memoize.rb