Sha256: a9198888d67f20ce5918824ebc0c5a45c6664ca23754fb7d697ef9f06ed8e26e
Contents?: true
Size: 773 Bytes
Versions: 2
Compression:
Stored size: 773 Bytes
Contents
# :nodoc: all require "test/unit" require "n/utils/cache" class TC_N_Utils_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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.2.0 | test/n/utils/tc_cache.rb |
nitro-0.3.0 | test/n/utils/tc_cache.rb |