Sha256: f05858976a90e5f9fda2f7f63ffa0e65fc41d59216da75ef8fb8f4b0ab0bb62e

Contents?: true

Size: 745 Bytes

Versions: 9

Compression:

Stored size: 745 Bytes

Contents

# :nodoc: all

require "test/unit"
require "glue/hash"

class TC_N2_Utils_Cache < Test::Unit::TestCase
	# :nodoc: all

	def setup
		@safe_cache = N::SafeHash.new(Hash.new)
	end

	def teardown
		@safe_cache = nil
	end

	def test_safe_cache
		assert_equal(nil, @safe_cache["no_item"])
		item1 =  "item1"
		@safe_cache["key1"] = item1
		assert_equal(item1, @safe_cache["key1"])

		@safe_cache["rem1"] = item1
		@safe_cache.delete("rem1")
		assert_equal(nil, @safe_cache["rem1"])

		@safe_cache.clear()
		assert_equal(0, @safe_cache.size)

		@safe_cache["i1"] = "i1"
		@safe_cache["i2"] = "i1"
		@safe_cache["i3"] = "i1"
		assert_equal(3, @safe_cache.size)

		assert_equal(3, @safe_cache.values.size)
	end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
glue-0.15.0 test/glue/tc_hash.rb
glue-0.13.0 test/glue/tc_hash.rb
glue-0.14.0 test/glue/tc_hash.rb
nitro-0.10.0 test/glue/tc_hash.rb
nitro-0.11.0 test/glue/tc_hash.rb
nitro-0.12.0 test/glue/tc_hash.rb
nitro-0.8.0 test/glue/tc_hash.rb
nitro-0.9.3 test/glue/tc_hash.rb
nitro-0.9.5 test/glue/tc_hash.rb