11-cpp.t (rakudo-2020.09) | : | 11-cpp.t (rakudo-2020.10) | ||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
compile_cpp_test_lib('11-cpp'); | compile_cpp_test_lib('11-cpp'); | |||
CATCH { | CATCH { | |||
default { | default { | |||
diag "Error while compiling C++ script:\n$_.payload()"; | diag "Error while compiling C++ script:\n$_.payload()"; | |||
print "1..0 # Skip: Cannot compile C++ script\n"; | print "1..0 # Skip: Cannot compile C++ script\n"; | |||
exit 0 | exit 0 | |||
} | } | |||
} | } | |||
} | } | |||
plan 21; | plan 22; | |||
#~ shell 'dumpbin /exports 11-cpp.dll'; | #~ shell 'dumpbin /exports 11-cpp.dll'; | |||
#~ shell 'clang --shared -fPIC -o 11-cpp.so t/04-nativecall/11-cpp.cpp'; | #~ shell 'clang --shared -fPIC -o 11-cpp.so t/04-nativecall/11-cpp.cpp'; | |||
#~ shell 'nm 11-cpp.so'; | #~ shell 'nm 11-cpp.so'; | |||
#~ shell 'clang -cc1 -fdump-record-layouts t/04-nativecall/11-cpp.cpp'; | #~ shell 'clang -cc1 -fdump-record-layouts t/04-nativecall/11-cpp.cpp'; | |||
class Point is repr<CStruct> { | class Point is repr<CStruct> { | |||
has num32 $.x; | has num32 $.x; | |||
has num32 $.y; | has num32 $.y; | |||
} | } | |||
skipping to change at line 52 | skipping to change at line 52 | |||
has num64 $.cx; | has num64 $.cx; | |||
has num64 $.cy; | has num64 $.cy; | |||
has uint8 $.c; | has uint8 $.c; | |||
method new() returns Derived1 is native("./11-cpp") is nativeconv('thisgnu') { * } # const * | method new() returns Derived1 is native("./11-cpp") is nativeconv('thisgnu') { * } # const * | |||
} | } | |||
sub SizeofDerived1() returns int32 is mangled is native("./11-cpp") { * } | sub SizeofDerived1() returns int32 is mangled is native("./11-cpp") { * } | |||
is nativesizeof(Derived1), SizeofDerived1(), 'sizeof(Derived1)'; | is nativesizeof(Derived1), SizeofDerived1(), 'sizeof(Derived1)'; | |||
ok my $d1 = Derived1.new, 'can instantiate C++ class'; | ok my $d1 = Derived1.new, 'can instantiate C++ class'; | |||
ok my Derived1 $d1b .= new, 'can instantiate the same C++ class again using « .= »'; | ||||
is $d1.foo, 11, 'can read attribute foo'; | is $d1.foo, 11, 'can read attribute foo'; | |||
is $d1.bar, 42, 'can read attribute bar'; | is $d1.bar, 42, 'can read attribute bar'; | |||
is $d1.baz, 43, 'can read attribute baz'; | is $d1.baz, 43, 'can read attribute baz'; | |||
is $d1.cx, 3.14, 'can read attribute cx'; | is $d1.cx, 3.14, 'can read attribute cx'; | |||
is $d1.cy, 2.62, 'can read attribute cy'; | is $d1.cy, 2.62, 'can read attribute cy'; | |||
is $d1.c.chr, 'A', 'can read attribute c'; | is $d1.c.chr, 'A', 'can read attribute c'; | |||
class Derived2 is repr<CPPStruct> { | class Derived2 is repr<CPPStruct> { | |||
has VirtualMethodTable $.vtable; | has VirtualMethodTable $.vtable; | |||
has int32 $.foo; | has int32 $.foo; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |