Sha256: f6218d7c2024e6e4cb5ad21eba45e15b61be40cc5b4c3675d283a516b55bf796
Contents?: true
Size: 752 Bytes
Versions: 9
Compression:
Stored size: 752 Bytes
Contents
require "test/unit" require "glue/cache" class TC_Glue_Cache < Test::Unit::TestCase # :nodoc: all class Dummy include N::LRUCache::Item end def setup @cache = N::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
9 entries across 9 versions & 2 rubygems