[ruby] make std::multiset and std::unordered_multiset include Enumerable. tests added.
This commit is contained in:
parent
005e129287
commit
9f43082786
3 changed files with 19 additions and 1 deletions
|
|
@ -5,6 +5,9 @@ require 'cpp11_hash_tables'
|
|||
Cpp11_hash_tables::MultiMapIntInt.new({1=>7}),
|
||||
Cpp11_hash_tables::UnorderedMapIntInt.new({1=>7}),
|
||||
Cpp11_hash_tables::UnorderedMultiMapIntInt.new({1=>7})].each{|x|
|
||||
|
||||
swig_assert_equal("x.find_all{|e,k| e == 1}", "[[1,7]]", binding)
|
||||
|
||||
swig_assert_equal("x[1]", "7", binding)
|
||||
swig_assert_equal("x[2]", "nil", binding)
|
||||
x[2] = 9
|
||||
|
|
@ -27,6 +30,9 @@ require 'cpp11_hash_tables'
|
|||
Cpp11_hash_tables::MultiSetInt.new([1]),
|
||||
Cpp11_hash_tables::UnorderedSetInt.new([1]),
|
||||
Cpp11_hash_tables::UnorderedMultiSetInt.new([1])].each{|x|
|
||||
|
||||
swig_assert_equal("x.find_all{|e| e == 1}", "[1]", binding)
|
||||
|
||||
swig_assert_equal("x.include?(1)", "true", binding)
|
||||
swig_assert_equal("x.include?(2)", "false", binding)
|
||||
x << 2
|
||||
|
|
@ -42,3 +48,13 @@ require 'cpp11_hash_tables'
|
|||
x << 1
|
||||
swig_assert_equal("x.count(1)", "2", binding)
|
||||
}
|
||||
|
||||
[Cpp11_hash_tables::MapIntInt,
|
||||
Cpp11_hash_tables::MultiMapIntInt,
|
||||
Cpp11_hash_tables::UnorderedMapIntInt,
|
||||
Cpp11_hash_tables::UnorderedMultiMapIntInt,
|
||||
Cpp11_hash_tables::SetInt,
|
||||
Cpp11_hash_tables::UnorderedSetInt,
|
||||
Cpp11_hash_tables::UnorderedMultiSetInt].each{|k|
|
||||
swig_assert("k.include?(Enumerable)", binding)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue