From b38eae9915f8560d200dfa737bfcd688cef17c50 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Sat, 3 Apr 2004 08:38:12 +0000 Subject: [PATCH] more cases git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5825 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/python/Makefile.in | 1 + Examples/test-suite/python/complextest.i | 5 ++ Examples/test-suite/python/lib_std_map.i | 70 +++++++++++++++++++ .../test-suite/python/lib_std_map_runme.py | 17 +++++ 4 files changed, 93 insertions(+) create mode 100644 Examples/test-suite/python/lib_std_map.i create mode 100644 Examples/test-suite/python/lib_std_map_runme.py diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index 66f1f5e64..4113a8b17 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -16,6 +16,7 @@ CPP_TEST_CASES += \ director_stl \ implicittest \ lib_std_vectora \ + lib_std_map \ std_containers # diff --git a/Examples/test-suite/python/complextest.i b/Examples/test-suite/python/complextest.i index 03ad5aebf..92dc62fc2 100644 --- a/Examples/test-suite/python/complextest.i +++ b/Examples/test-suite/python/complextest.i @@ -45,6 +45,11 @@ { return conj(a); } + + float_complex Conjf(float_complex a) + { + return conj(a); + } } diff --git a/Examples/test-suite/python/lib_std_map.i b/Examples/test-suite/python/lib_std_map.i new file mode 100644 index 000000000..e33c59e3b --- /dev/null +++ b/Examples/test-suite/python/lib_std_map.i @@ -0,0 +1,70 @@ +%module lib_std_map + +//#define SWIG_STD_EXTEND_COMPARISON +/// +%include std_pair.i +%include std_map.i + +%inline %{ +struct A{ + int val; + + A(int v = 0): val(v) + { + } + +}; +%} + +namespace std +{ + %template(pairii) pair; + %template(pairA) pair; + %template(mapA) map; +} + + + +%inline +{ +std::pair +p_identa(std::pair p) { + return p; +} + +std::map m_identa(const std::map& v) +{ + return v; +} + +} + + + +%inline %{ + struct C{}; + typedef C* pC; + + template + struct Test + { + Test (A a, B b) + { + } + + }; + + + template + struct Test + { + Test (A a, B* b) + { + } + + }; +%} + + +%template(test_pC) Test; + diff --git a/Examples/test-suite/python/lib_std_map_runme.py b/Examples/test-suite/python/lib_std_map_runme.py new file mode 100644 index 000000000..00fe41a89 --- /dev/null +++ b/Examples/test-suite/python/lib_std_map_runme.py @@ -0,0 +1,17 @@ +import lib_std_map + +a1 = lib_std_map.A(3) +a2 = lib_std_map.A(7) + + +if 1: + p0 = lib_std_map.pairii(1,2) + p1 = lib_std_map.pairA(1,a1.this) + m = {} + m[1] = a1 + m[2] = a2 + + lib_std_map.p_identa(p1) + lib_std_map.m_identa(m) + +