Python std::unordered_set tidy up and additional testing
This commit is contained in:
parent
72ccea5080
commit
631e26ae48
2 changed files with 4 additions and 3 deletions
|
|
@ -34,6 +34,7 @@ for x in [cpp11_hash_tables.MultiMapIntInt({1:7}),
|
|||
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})]:
|
||||
x[1] = 9
|
||||
swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
|
||||
swig_assert_equal(len(x), 2)
|
||||
|
||||
for x in [cpp11_hash_tables.SetInt([1]),
|
||||
cpp11_hash_tables.MultiSetInt([1]),
|
||||
|
|
@ -56,3 +57,4 @@ for x in [cpp11_hash_tables.MultiSetInt([1]),
|
|||
cpp11_hash_tables.UnorderedMultiSetInt([1])]:
|
||||
x.append(1)
|
||||
swig_assert_equal(x.count(1), 2)
|
||||
swig_assert_equal(len(x), 2)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
%extend {
|
||||
%extend {
|
||||
void append(value_type x) {
|
||||
self->insert(x);
|
||||
}
|
||||
|
|
@ -61,8 +61,7 @@
|
|||
value_type __getitem__(difference_type i) const throw (std::out_of_range) {
|
||||
return *(swig::cgetpos(self, i));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
%enddef
|
||||
|
||||
%include <std/std_unordered_set.i>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue