Fix std::map<> typemap

Use simple fixed typemap instead of trying to use the much more complex
one from the UTL which doesn't work for C.

Add a simple test case for std::map<>.
This commit is contained in:
Vadim Zeitlin 2021-10-06 20:20:55 +02:00
commit 9efb508eda
3 changed files with 87 additions and 2 deletions

View file

@ -66,7 +66,6 @@ FAILING_CPP_TESTS := \
li_boost_shared_ptr_director \
li_boost_shared_ptr_template \
li_std_deque \
li_std_map \
li_std_pair_using \
li_std_wstring \
li_windows \

View file

@ -0,0 +1,26 @@
#include "li_std_map/li_std_map_wrap.h"
#include <assert.h>
int main() {
A* a1 = A_new_i(3);
A* a2 = A_new_i(7);
mapA* mA = mapA_new();
mapA_set(mA, 1, a1);
mapA_set(mA, 2, a2);
assert( mapA_size(mA) == 2 );
{
A* a = mapA_get(mA, 1);
assert( A_val_get(a) == 3 );
}
assert( !mapA_has_key(mA, 3) );
mapA_delete(mA);
A_delete(a2);
A_delete(a1);
return 0;
}