out.println("\ntesting object mappings: ...");
int n = -1;
out.println("\ncalling A.create_r()...");
A a = A.create_r();
out.println("... a = " + a);
assert (a != null);
out.println("\ncalling A.create_p()...");
A ap = A.create_p();
out.println("... a = " + ap);
assert (a != null);
out.println("\ncalling a.f0s()...");
n = a.f0s();
out.println("... a.f0s() = " + n);
assert (n == 10);
out.println("\ncalling A.f0n(a)...");
n = A.f0n(a);
out.println("... A.f0n(a) = " + n);
assert (n == 11);
out.println("\ncalling a.f0v1()...");
n = a.f0v();
out.println("... a.f0v() = " + n);
assert (n == 12);
out.println("\ncalling A.d0sc()...");
n = A.d0sc();
out.println("... A.d0sc() = " + n);
assert (n == -10);
out.println("\ncalling a.d0sc()...");
n = a.d0sc();
out.println("... a.d0sc() = " + n);
assert (n == -10);
out.println("\ncalling A.d0s(A.d0s() + 1)...");
A.d0s(A.d0s() + 1);
out.println("\n... calling A.d0s()...");
n = A.d0s();
out.println("... A.d0s() = " + n);
assert (n == 11);
out.println("\ncalling a.d0s(a.d0s() + 1)...");
a.d0s(a.d0s() + 1);
out.println("\n... calling a.d0s()...");
n = a.d0s();
out.println("... a.d0s() = " + n);
assert (n == 12);
out.println("\ncalling a.d0c()...");
n = a.d0c();
out.println("... a.d0c() = " + n);
assert (n == -11);
out.println("\ncalling a.d0(a.d0() + 1)...");
a.d0(a.d0() + 1);
out.println("\n... calling a.d0()...");
n = a.d0();
out.println("... a.d0() = " + n);
assert (n == 12);
out.println("\ncalling B0...");
n = B0.f0s();
out.println("... B0.f0s() = " + n);
assert (n == 20);
out.println("\ncalling a.newB0()...");
B0 b0b0 = a.newB0();
out.println("... b0b0 = " + b0b0);
assert (b0b0 != null);
out.println("\ncalling b0b0.f0s()...");
n = b0b0.f0s();
out.println("... b0b0.f0s() = " + n);
assert (n == 20);
out.println("\ncalling B0.f0n(b0b0)...");
n = B0.f0n(b0b0);
out.println("... B0.f0n(b0b0) = " + n);
assert (n == 21);
out.println("\ncalling b0b0.f0v()...");
n = b0b0.f0v();
out.println("... b0b0.f0v() = " + n);
assert (n == 22);
out.println("\ncalling B0.d0sc()...");
n = B0.d0sc();
out.println("... B0.d0sc() = " + n);
assert (n == -20);
out.println("\ncalling b0b0.d0sc()...");
n = b0b0.d0sc();
out.println("... b0b0.d0sc() = " + n);
assert (n == -20);
out.println("\ncalling B0.d0s(B0.d0s() + 1)...");
B0.d0s(B0.d0s() + 1);
out.println("\n... calling B0.d0s()...");
n = B0.d0s();
out.println("... B0.d0s() = " + n);
assert (n == 21);
out.println("\ncalling b0b0.d0s(b0b0.d0s() + 1)...");
b0b0.d0s(b0b0.d0s() + 1);
out.println("\n... calling b0b0.d0s()...");
n = b0b0.d0s();
out.println("... b0b0.d0s() = " + n);
assert (n == 22);
out.println("\ncalling B0.d0c(b0b0)...");
n = B0.d0c(b0b0);
out.println("... B0.d0c(b0b0) = " + n);
assert (n == -21);
out.println("\ncalling B0.d0(b0b0, B0.d0(b0b0) + 1)...");
B0.d0(b0b0, B0.d0(b0b0) + 1);
out.println("\n... calling B0.d0(b0b0)...");
n = B0.d0(b0b0);
out.println("... B0.d0(b0b0) = " + n);
assert (n == 22);
out.println("\ncalling a.del(b0b0)...");
a.del(b0b0);
out.println("\ncalling B1.f0s()...");
n = B1.f0s();
out.println("... B1.f0s() = " + n);
assert (n == 30);
out.println("\ncalling a.newB1()...");
B1 b1b1 = a.newB1();
B0 b0b1 = b1b1;
out.println("... b0b1 = " + b0b1);
assert (b0b1 != null);
out.println("\ncalling b0b1.f0s()...");
n = b0b1.f0s();
out.println("... b0b1.f0s() = " + n);
assert (n == 20);
out.println("\ncalling B0.f0n(b0b1)...");
n = B0.f0n(b0b1);
out.println("... B0.f0n(b0b1) = " + n);
assert (n == 21);
out.println("\ncalling b0b1.f0v()...");
n = b0b1.f0v();
out.println("... b0b1.f0v() = " + n);
assert (n == 32);
out.println("\ncalling B1.d0sc()...");
n = B1.d0sc();
out.println("... B1.d0sc() = " + n);
assert (n == -30);
out.println("\ncalling b1b1.d0sc()...");
n = b1b1.d0sc();
out.println("... b1b1.d0sc() = " + n);
assert (n == -30);
out.println("\ncalling B1.d0s(B1.d0s() + 1)...");
B1.d0s(B1.d0s() + 1);
out.println("\n... calling B1.d0s()...");
n = B1.d0s();
out.println("... B1.d0s() = " + n);
assert (n == 31);
out.println("\ncalling b1b1.d0s(b1b1.d0s() + 1)...");
b1b1.d0s(b1b1.d0s() + 1);
out.println("\n... calling b1b1.d0s()...");
n = b1b1.d0s();
out.println("... b1b1.d0s() = " + n);
assert (n == 32);
out.println("\ncalling B1.d0c(b1b1)...");
n = B1.d0c(b1b1);
out.println("... B1.d0c(b1b1) = " + n);
assert (n == -31);
out.println("\ncalling B1.d0(b1b1, B1.d0(b1b1) + 1)...");
B1.d0(b1b1, B1.d0(b1b1) + 1);
out.println("\n... calling B1.d0(b1b1)...");
n = B1.d0(b1b1);
out.println("... B1.d0(b1b1) = " + n);
assert (n == 32);
out.println("\ncalling a.del(b1b1)...");
a.del(b1b1);
out.println("\ncalling A.print()...");
A.print(a);
out.println("\ncalling A.delete_r(a)...");
A.delete_r(a);
out.println("... a = " + a);
out.println("\ncalling A.delete_p(ap)...");
A.delete_p(ap);
out.println("... ap = " + ap);
out.println("\ncalling A.print()...");
try {
A.print(a);
throw new RuntimeException("Expected exception not thrown.");
} catch (AssertionError e) {
out.println("... successfully caught: " + e);
}
out.println("\ncalling A.deliver_ptr()...");
A pa = A.deliver_ptr();
assert (pa != null);
out.println("\ncalling A.take_ptr()...");
A.take_ptr(pa);
out.println("\ncalling A.deliver_null_ptr()...");
A p0 = A.deliver_null_ptr();
assert (p0 == null);
out.println("\ncalling A.take_null_ptr()...");
A.take_null_ptr(p0);
out.println("\ncalling A.deliver_ref()...");
A ra = A.deliver_ref();
assert (ra != null);
out.println("\ncalling A.take_ref()...");
A.take_ref(ra);