Sha256: fb7423a005bd77c09a346d2375763a0c62fbd70b6b86c7eacdb0ec87f6cbe68f

Contents?: true

Size: 743 Bytes

Versions: 3

Compression:

Stored size: 743 Bytes

Contents

# :nodoc: all

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

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

	def setup
		@safe_cache = G::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

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.5.0 test/glue/tc_hash.rb
nitro-0.6.0 test/glue/tc_hash.rb
nitro-0.7.0 test/glue/tc_hash.rb