Class: TestMemoize
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestMemoize
- Defined in:
- lib/rip/memoize.rb
Defined Under Namespace
Classes: Encoder
Instance Method Summary collapse
- #setup ⇒ Object
- #test_memoizes_argless_methods ⇒ Object
- #test_memoizes_method ⇒ Object
- #test_memoizes_multiple_methods ⇒ Object
- #test_properly_executes_methods ⇒ Object
- #test_uses_simple_ivar_for_argless_methods ⇒ Object
Instance Method Details
#test_memoizes_argless_methods ⇒ Object
100 101 102 103 104 |
# File 'lib/rip/memoize.rb', line 100 def test_memoizes_argless_methods @obj.simple @obj.simple assert_equal 1, @obj.encodes end |
#test_memoizes_method ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/rip/memoize.rb', line 83 def test_memoizes_method @obj.encode('chris') @obj.encode('chris') @obj.encode('chris') assert_equal 1, @obj.encodes end |
#test_memoizes_multiple_methods ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/rip/memoize.rb', line 91 def test_memoizes_multiple_methods @obj.encode('chris') @obj.encode('bob') @obj.encode('chris') @obj.encode('bob') assert_equal 2, @obj.encodes end |
#test_properly_executes_methods ⇒ Object
78 79 80 81 |
# File 'lib/rip/memoize.rb', line 78 def test_properly_executes_methods @obj.encode('chris') assert_equal '99/104/114/105/115', @obj.encode('chris') end |
#test_uses_simple_ivar_for_argless_methods ⇒ Object
106 107 108 109 |
# File 'lib/rip/memoize.rb', line 106 def test_uses_simple_ivar_for_argless_methods @obj.simple assert_equal 2, @obj.instance_variable_get(:@simple) end |