summaryrefslogtreecommitdiff
path: root/test/objspace/test_objspace.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-27 18:16:39 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-27 18:16:39 +0000
commitb36aa7af03a481fc1f41533256a78946498ba0ae (patch)
tree2d071af1f267d55fe95d45116d1d25b1115a5f4c /test/objspace/test_objspace.rb
parent430c1d3fe4d107e141676fedf56ace98221b3b99 (diff)
* ext/objspace/objspace.c (memsize_of): fix rdoc.
* ext/objspace/objspace.c (total_memsize_of_all_objects): added. * test/objspace/test_objspace.rb: - add a test for ObjectSpace.total_memsize_of_all_objects. - add two tests for ObjectSpace.memsize_of (for nil and Fixnum). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/objspace/test_objspace.rb')
-rw-r--r--test/objspace/test_objspace.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index cfdb4857470..ceb9650b6e5 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -4,6 +4,8 @@ require "objspace"
class TestObjSpace < Test::Unit::TestCase
def test_memsize_of
assert_equal(0, ObjectSpace.memsize_of(true))
+ assert_equal(0, ObjectSpace.memsize_of(nil))
+ assert_equal(0, ObjectSpace.memsize_of(1))
assert_kind_of(Integer, ObjectSpace.memsize_of(Object.new))
assert_kind_of(Integer, ObjectSpace.memsize_of(Class))
assert_kind_of(Integer, ObjectSpace.memsize_of(""))
@@ -17,6 +19,10 @@ class TestObjSpace < Test::Unit::TestCase
assert_kind_of(Integer, ObjectSpace.memsize_of(Struct.new(:a)))
end
+ def test_total_memsize_of_all_objects
+ assert_kind_of(Integer, ObjectSpace.total_memsize_of_all_objects)
+ end
+
def test_count_objects_size
res = ObjectSpace.count_objects_size
assert_equal(false, res.empty?)