Skip to content

Instantly share code, notes, and snippets.

@retupmoca
Created March 14, 2014 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retupmoca/00328e01ee438ee94126 to your computer and use it in GitHub Desktop.
Save retupmoca/00328e01ee438ee94126 to your computer and use it in GitHub Desktop.
moar nativecall testing
> perl6 -Ilib t/01-argless.t
1..3
/bin/sh: PREFIX: command not found
ok 1 - Called argless function
ok 2 - survived the call
ok 3 - called long_and_complicated_name> perl6 -Ilib t/02-simple-args.t
1..11
/bin/sh: PREFIX: command not found
ok 1 - got passed int 42
ok 2 - got passed short 10
ok 3 - got passed short 20
ok 4 - got passed int 101
ok 5 - got passed short 102
ok 6 - got passed char 103
ok 7 - got passed double -6.9
ok 8 - got passed float 4.2
ok 9 - passed a string
Segmentation fault
> perl6 -Ilib t/03-simple-returns.t
1..7
/bin/sh: PREFIX: command not found
ok 1 - returning int works
ok 2 - returning short works
ok 3 - returning char works
ok 4 - returning double works
ok 5 - returning float works
ok 6 - returning string works
ok 7 - returning null string pointer
> perl6 -Ilib t/04-pointers.t
1..1
/bin/sh: PREFIX: command not found
ok 1 - Got passed back the pointer I returned
> perl6 -Ilib t/05-arrays.t
1..26
/bin/sh: PREFIX: command not found
ok 1 - returning double array (1)
ok 2 - returning double array (2)
ok 3 - returning double array (3)
ok 4 - passing double array
ok 5 - returning string array (1)
ok 6 - returning string array (2)
ok 7 - passing string array
ok 8 - getting last element of managed array
ok 9 - getting uninitialized element in managed array
ok 10 - int in struct in element 0
ok 11 - int in struct in element 1
ok 12 - int in struct in element 2
ok 13 - out-of-bounds access on managed array
ok - struct in position 0, C-side
ok - struct in position 1, C-side
ok - struct in position 2, C-side
ok 14 - byte in element 0
ok 15 - byte in element 1
ok 16 - byte in element 2
ok - byte in position 0, C-side
ok - byte in position 1, C-side
ok - byte in position 2, C-side
ok 17 - float in element 0
ok 18 - float in element 1
ok 19 - float in element 2
ok 20 - sum of float array
# Looks like you planned 26 tests, but ran 20
> perl6 -Ilib t/06-struct.t
1..30
/bin/sh: PREFIX: command not found
ok 1 - getting int
ok 2 - getting num
ok 3 - getting int8
ok 4 - getting num32
ok 5 - getting CArray and element
ok 6 - getting int from C-created struct
ok 7 - getting num from C-created struct
ok 8 - getting int8 from C-created struct
ok 9 - getting num32 from C-created struct
ok 10 - C-created array member, elem 1
ok 11 - C-created array member, elem 2
ok 12 - C-created array member, elem 3
ok 13 - field 1 from struct 1 in struct
ok 14 - field 2 from struct 1 in struct
ok 15 - field 1 from struct 2 in struct
ok 16 - field 2 from struct 2 in struct
ok 17 - CPointer object in struct
ok 18 - first string in struct
ok 19 - second string in struct
ok - C-side int value
ok - C-side num value
ok - C-side int8 value
ok - C-side array value, element 1
ok - C-side array value, element 2
ok - int 1 in struct 1 in struct
ok - int 2 in struct 1 in struct
ok - int 1 in struct 2 in struct
ok - int 2 in struct 2 in struct
ok - C-value of first string in struct
ok - C-value of second string in struct
# Looks like you planned 30 tests, but ran 19
> perl6 -Ilib t/07-writebarrier.t
1..7
/bin/sh: PREFIX: command not found
ok 1 - pointer in struct before twiddle
not ok 2 - pointer in struct after twiddle
# got: '32'
# expected: '9'
not ok 3 - array element 1 after twiddle
# got: '32'
# expected: '1'
not ok 4 - array element 2 after twiddle
# got: '32'
# expected: '2'
not ok 5 - array element 3 after twiddle
# got: '32'
# expected: '3'
ok 6 - ignore NULL arguments
nativecallrefresh NYI
in sub refresh at /home/andrew/perl6/zavolaj/lib/NativeCall.pm6:272
in block at t/07-writebarrier.t:51
# Looks like you planned 7 tests, but ran 6
# Looks like you failed 4 tests of 6
> perl6 -Ilib t/08-callbacks.t
1..9
/bin/sh: PREFIX: command not found
passing callback NYI
in method postcircumfix:<( )> at /home/andrew/perl6/zavolaj/lib/NativeCall.pm6:132
in block at t/08-callbacks.t:61
# Looks like you planned 9 tests, but ran 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment