swig/Examples/test-suite/c/li_std_pair_runme.c
Vadim Zeitlin 2f6f6df211 Generate wrapper aliases only if requested and not by default
Defining the aliases by default results in conflicts when including
headers from multiple modules as e.g. SWIG_PendingException_get() is
defined in all of them, and could also easily result in other unwanted
clashes, so make this opt-in and update the examples and tests relying
on using the wrappers without the module prefix to define
SWIG_DEFINE_WRAPPER_ALIASES explicitly.
2021-10-20 01:57:20 +02:00

43 lines
1.3 KiB
C

#define SWIG_DEFINE_WRAPPER_ALIASES
#include "li_std_pair/li_std_pair_wrap.h"
#include <assert.h>
int main() {
{
IntPair* intPair = makeIntPair(7, 6);
assert(IntPair_first_get(intPair)==7 && IntPair_second_get(intPair)==6);
assert(product1(intPair) == 42);
assert(product2(intPair) == 42);
assert(product3(intPair) == 42);
IntPair_delete(intPair);
}
{
IntPair* intPairPtr = makeIntPairPtr(7, 6);
assert(IntPair_first_get(intPairPtr)==7 && IntPair_second_get(intPairPtr)==6);
assert(product1(intPairPtr) == 42);
assert(product2(intPairPtr) == 42);
assert(product3(intPairPtr) == 42);
}
{
IntPair* intPairRef = makeIntPairRef(7, 6);
assert(IntPair_first_get(intPairRef)==7 && IntPair_second_get(intPairRef)==6);
assert(product1(intPairRef) == 42);
assert(product2(intPairRef) == 42);
assert(product3(intPairRef) == 42);
}
{
IntPair* intPairConstRef = makeIntPairConstRef(7, 6);
assert(IntPair_first_get(intPairConstRef)==7 && IntPair_second_get(intPairConstRef)==6);
assert(product1(intPairConstRef) == 42);
assert(product2(intPairConstRef) == 42);
assert(product3(intPairConstRef) == 42);
}
}