[ruby] add tests for upcasting std::shared_ptr within std containers.

This commit is contained in:
Takashi Tamura 2017-03-01 21:32:03 +09:00
commit a84ea749b3
3 changed files with 110 additions and 0 deletions

View file

@ -31,6 +31,7 @@ CPP_TEST_CASES = \
CPP11_TEST_CASES = \
cpp11_hash_tables \
cpp11_shared_ptr_upcast
C_TEST_CASES += \
li_cstring \

View file

@ -0,0 +1,12 @@
require 'swig_assert'
require 'cpp11_shared_ptr_upcast'
include Cpp11_shared_ptr_upcast
simple_assert_equal( 7, derived_num(Derived.new(7)) )
simple_assert_equal( 7, derived_num([Derived.new(7)]) )
simple_assert_equal( 7, derived_num({0 => Derived.new(7)}) )
simple_assert_equal(-1, base_num(Derived.new(7)) )
simple_assert_equal(-1, base_num([Derived.new(7)]) )
simple_assert_equal(-1, base_num({0 => Derived.new(7)}) )