Python std::unordered_map std::unordered_multimap improvements
- Fixes for -builtin - Fix missing iterator support
This commit is contained in:
parent
603285ecb6
commit
72ccea5080
3 changed files with 60 additions and 16 deletions
|
|
@ -6,12 +6,18 @@ def swig_assert_equal(a, b):
|
|||
|
||||
for x in [cpp11_hash_tables.MapIntInt({1:7}),
|
||||
cpp11_hash_tables.MultiMapIntInt({1:7}),
|
||||
# TODO: fix for -builtin
|
||||
# cpp11_hash_tables.UnorderedMapIntInt({1:7}),
|
||||
# cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})
|
||||
cpp11_hash_tables.UnorderedMapIntInt({1:7}),
|
||||
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})
|
||||
]:
|
||||
|
||||
swig_assert_equal([(k, v) for k, v in x.iteritems()], [(1, 7)])
|
||||
swig_assert_equal(x.keys(), [1])
|
||||
swig_assert_equal(x.values(), [7])
|
||||
swig_assert_equal(x.items(), [(1, 7)])
|
||||
swig_assert_equal([k for k in x], [1])
|
||||
swig_assert_equal([i for i in x.iterkeys()], [1])
|
||||
swig_assert_equal([i for i in x.itervalues()], [7])
|
||||
swig_assert_equal([i for i in x.iteritems()], [(1, 7)])
|
||||
|
||||
swig_assert_equal(x[1], 7)
|
||||
swig_assert_equal(2 in x, False)
|
||||
|
|
@ -27,10 +33,7 @@ for x in [cpp11_hash_tables.MapIntInt({1:7}),
|
|||
for x in [cpp11_hash_tables.MultiMapIntInt({1:7}),
|
||||
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})]:
|
||||
x[1] = 9
|
||||
# TODO: fix for -builtin
|
||||
# swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
|
||||
# Is this broken?...
|
||||
# swig_assert_equal(sorted([v for v in x[1]]), [7, 9])
|
||||
swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
|
||||
|
||||
for x in [cpp11_hash_tables.SetInt([1]),
|
||||
cpp11_hash_tables.MultiSetInt([1]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue