swig/Examples/test-suite/c/cpp11_shared_ptr_upcast_runme.c
Vadim Zeitlin e78c8f39ed Add minimal shared_ptr support
Enable the tests and support of shared_ptr in them for C (which required
disabling a previously passing, because not doing anything, attributes
test which is currently broken for unrelated reasons).
2021-10-15 01:26:22 +02:00

26 lines
589 B
C

#include "cpp11_shared_ptr_upcast_wrap.h"
#include <assert.h>
int main(int argc, const char *argv[]) {
{
Derived* d;
d = Derived_new_i(17);
assert( cpp11_shared_ptr_upcast_base_num1((Base *)d) == -1 );
assert( cpp11_shared_ptr_upcast_derived_num1(d) == 17 );
Derived_delete(d);
}
{
Derived2* d2;
d2 = Derived2_new_i(289);
assert( cpp11_shared_ptr_upcast_base2_num1((Base2 *)d2) == -1 );
assert( cpp11_shared_ptr_upcast_derived2_num1(d2) == 289 );
Derived2_delete(d2);
}
return 0;
}