Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test rw variables (NativeRefs)
  • Loading branch information
FROGGS committed Apr 3, 2015
1 parent 00674de commit 9fbaf1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions t/04-nativecall/14-rw-attrs.c
Expand Up @@ -34,3 +34,7 @@ DLLEXPORT char GetCharOfStruct(MyStruct *obj) {
DLLEXPORT float GetFloatOfStruct(MyStruct *obj) {
return obj->floatval;
}

DLLEXPORT void SetFloat(float *flt) {
*flt = 6.66;
}
5 changes: 4 additions & 1 deletion t/04-nativecall/14-rw-attrs.t
Expand Up @@ -4,7 +4,7 @@ use lib 'lib';
use NativeCall;
use Test;

plan 16;
plan 17;

compile_test_lib('14-rw-attrs');

Expand Down Expand Up @@ -50,5 +50,8 @@ is_approx GetDoubleOfStruct($s), 43.3, 'C confirms (double)';
is GetCharOfStruct($s), 44, 'C confirms (char)';
is_approx GetFloatOfStruct($s), 45.5, 'C confirms (float)';

sub SetFloat(num32 is rw) is native('./14-rw-attrs') { * }
my num32 $a; SetFloat($a);
is_approx $a, 6.66, 'Perl\'s rw variable was set by C (float)';

# vim:ft=perl6

0 comments on commit 9fbaf1e

Please sign in to comment.