Sha256: 42c4a0ac172e7c8377176ff52f1912917154a7915d77567ecd4a9a17c8f79b66
Contents?: true
Size: 759 Bytes
Versions: 2
Compression:
Stored size: 759 Bytes
Contents
require 'test/unit' require 'glue/cache' class TC_Glue_Cache < Test::Unit::TestCase # :nodoc: all include Glue class Dummy include LRUCache::Item end def setup @cache = LRUCache.new(maxitems = 3) end def teardown @cache = nil end def test_safe_cache d1 = Dummy.new d2 = Dummy.new d3 = Dummy.new d4 = Dummy.new @cache[1] = d1 @cache[2] = d2 @cache[3] = d3 assert_equal(d1, @cache.last) assert_equal(d3, @cache.first) val = @cache[2] assert_equal(d2, @cache.first) @cache[4] = d4 assert_equal(3, @cache.size) assert_equal(d4, @cache.first) # insert the same key @cache[4] = d4 assert_equal(3, @cache.size) assert_equal(d4, @cache.first) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glue-0.16.0 | test/glue/tc_cache.rb |
glue-0.17.0 | test/glue/tc_cache.rb |