Fix std::vector of pointers which failed if a pointer to a pointer of the container element type existed (Python)

Closes SF Bug 2359417 created after commit 93f0390322 (svn rev 10958)
This commit is contained in:
William S Fulton 2016-07-27 19:49:38 +01:00
commit 6e9184b6f8
5 changed files with 120 additions and 9 deletions

View file

@ -1,7 +1,38 @@
from li_std_vector_ptr import *
def check(val1, val2):
if val1 != val2:
raise RuntimeError("Values are not the same %s %s" % (val1, val2))
ip1 = makeIntPtr(11)
ip2 = makeIntPtr(22)
vi = IntPtrVector((ip1, ip2))
displayVector(vi)
check(getValueFromVector(vi, 0), 11)
check(getValueFromVector(vi, 1), 22)
vA = APtrVector([makeA(33), makeA(34)])
check(getVectorValueA(vA, 0), 33)
vB = BPtrVector([makeB(133), makeB(134)])
check(getVectorValueB(vB, 0), 133)
vC = CPtrVector([makeC(1133), makeC(1134)])
check(getVectorValueC(vC, 0), 1133)
vA = [makeA(233), makeA(234)]
check(getVectorValueA(vA, 0), 233)
vB = [makeB(333), makeB(334)]
check(getVectorValueB(vB, 0), 333)
vC = [makeC(3333), makeC(3334)]
check(getVectorValueC(vC, 0), 3333)
# mixed A and B should not be accepted
vAB = [makeA(999), makeB(999)]
try:
check(getVectorValueA(vAB, 0), 999)
raise RuntimeError("missed exception")
except TypeError:
pass