@@ -49,6 +49,8 @@ class S8F32S32 < FFI::Struct
4949 callback :cbVrU32 , [ ] , :uint
5050 callback :cbVrL , [ ] , :long
5151 callback :cbVrUL , [ ] , :ulong
52+ callback :cbVrF , [ ] , :float
53+ callback :cbVrD , [ ] , :double
5254 callback :cbVrS64 , [ ] , :long_long
5355 callback :cbVrU64 , [ ] , :ulong_long
5456 callback :cbVrP , [ ] , :pointer
@@ -70,6 +72,8 @@ class S8F32S32 < FFI::Struct
7072 attach_function :testCallbackVrU16 , :testClosureVrS , [ :cbVrU16 ] , :ushort
7173 attach_function :testCallbackVrS32 , :testClosureVrI , [ :cbVrS32 ] , :int
7274 attach_function :testCallbackVrU32 , :testClosureVrI , [ :cbVrU32 ] , :uint
75+ attach_function :testCallbackVrF , :testClosureVrF , [ :cbVrF ] , :float
76+ attach_function :testCallbackVrD , :testClosureVrD , [ :cbVrD ] , :double
7377 attach_function :testCallbackVrL , :testClosureVrL , [ :cbVrL ] , :long
7478 attach_function :testCallbackVrZ , :testClosureVrZ , [ :cbVrZ ] , :bool
7579 attach_function :testCallbackVrUL , :testClosureVrL , [ :cbVrUL ] , :ulong
@@ -86,7 +90,6 @@ class S8F32S32 < FFI::Struct
8690 attach_variable :pVrS8 , :gvar_pointer , :pointer
8791 attach_function :testGVarCallbackVrS8 , :testClosureVrB , [ :pointer ] , :char
8892 attach_function :testOptionalCallbackCrV , :testOptionalClosureBrV , [ :cbCrV , :char ] , :void
89-
9093 end
9194
9295 it "returning :char (0)" do
@@ -261,6 +264,14 @@ class S8F32S32 < FFI::Struct
261264 expect ( LibTest . testCallbackVrZ { true } ) . to be true
262265 end
263266
267+ it "returning float" do
268+ expect ( LibTest . testCallbackVrF { 1.234567890123456789 } ) . to be_within ( 1E-7 ) . of ( 1.234567890123456789 )
269+ end
270+
271+ it "returning double" do
272+ expect ( LibTest . testCallbackVrD { 1.234567890123456789 } ) . to be_within ( 1E-15 ) . of ( 1.234567890123456789 )
273+ end
274+
264275 it "returning :pointer (nil)" do
265276 expect ( LibTest . testCallbackVrP { nil } ) . to be_null
266277 end
0 commit comments