PageRenderTime 29ms CodeModel.GetById 15ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/test-suite/ruby/newobject1_runme.rb

#
Ruby | 33 lines | 11 code | 4 blank | 18 comment | 1 complexity | b6267e1d659b45ad4072c468d9ec712a MD5 | raw file
 1#!/usr/bin/env ruby
 2#
 3# Simple test of %newobject
 4#  * The purpose of this test is to confirm that a language module
 5#  * correctly handles the case when C++ class member functions (of both
 6#  * the static and non-static persuasion) have been tagged with the
 7#  * %newobject directive.
 8#
 9# Ruby's GC is somewhat broken in that it will mark some more stack space
10# leading to the collection of local objects to be delayed.
11# Thus, upon invokation, it sometimes you can wait up to several
12# instructions to kick in.
13# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7449
14#
15# 
16# 
17# 
18#
19
20require 'swig_assert'
21require 'swig_gc'
22require 'newobject1'
23
24include Newobject1
25
26GC.track_class = Foo
27GC.start
28100.times { foo1 = Foo.makeFoo; foo2 = foo1.makeMore }
29GC.stats if $VERBOSE
30swig_assert( 'Foo.fooCount == 200', binding, "but is #{Foo.fooCount}" )
31GC.start
32swig_assert( 'Foo.fooCount <= 2', binding, "but is #{Foo.fooCount}" )
33