8 use base qw/ DynaLoader Exporter /;
10 # Items to export into callers namespace by default. Note: do not export
11 # names by default without a very good reason. Use EXPORT_OK instead.
12 # Do not simply export all your public functions/methods/constants.
14 # Export everything since these functions are only used by a test script
15 our @EXPORT = qw( print_double print_int print_long
16 print_float print_long_double have_long_double print_flush
17 mpushp mpushn mpushi mpushu
18 mxpushp mxpushn mxpushi mxpushu
19 call_sv call_pv call_method eval_sv eval_pv require_pv
20 G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
21 G_KEEPERR G_NODEBUG G_METHOD
22 exception mycroak strtab
32 sub G_KEEPERR() { 16 }
33 sub G_NODEBUG() { 32 }
36 our $VERSION = '0.08';
38 bootstrap XS::APItest $VERSION;
45 XS::APItest - Test the perl C API
54 This module tests the perl C API. Currently tests that C<printf>
59 This module can be used to check that the perl C API is behaving
60 correctly. This module provides test functions and an associated
61 test script that verifies the output.
63 This module is not meant to be installed.
67 Exports all the test functions:
73 Test that a double-precision floating point number is formatted
74 correctly by C<printf>.
78 Output is sent to STDOUT.
80 =item B<print_long_double>
82 Test that a C<long double> is formatted correctly by
83 C<printf>. Takes no arguments - the test value is hard-wired
84 into the function (as "7").
88 Output is sent to STDOUT.
90 =item B<have_long_double>
92 Determine whether a C<long double> is supported by Perl. This should
93 be used to determine whether to test C<print_long_double>.
95 print_long_double() if have_long_double;
99 Test that an C<NV> is formatted correctly by
104 Output is sent to STDOUT.
108 Test that an C<IV> is formatted correctly by
113 Output is sent to STDOUT.
117 Test that an C<UV> is formatted correctly by
122 Output is sent to STDOUT.
126 Test that an C<int> is formatted correctly by
131 Output is sent to STDOUT.
135 Test that an C<long> is formatted correctly by
140 Output is sent to STDOUT.
144 Test that a single-precision floating point number is formatted
145 correctly by C<printf>.
149 Output is sent to STDOUT.
151 =item B<call_sv>, B<call_pv>, B<call_method>
153 These exercise the C calls of the same names. Everything after the flags
154 arg is passed as the the args to the called function. They return whatever
155 the C function itself pushed onto the stack, plus the return value from
156 the function; for example
158 call_sv( sub { @_, 'c' }, G_ARRAY, 'a', 'b'); # returns 'a', 'b', 'c', 3
159 call_sv( sub { @_ }, G_SCALAR, 'a', 'b'); # returns 'b', 1
163 Evaluates the passed SV. Result handling is done the same as for
168 Exercises the C function of the same name in scalar context. Returns the
169 same SV that the C function returns.
173 Exercises the C function of the same name. Returns nothing.
179 L<XS::Typemap>, L<perlapi>.
183 Tim Jenness, E<lt>t.jenness@jach.hawaii.eduE<gt>,
184 Christian Soeller, E<lt>csoelle@mph.auckland.ac.nzE<gt>,
185 Hugo van der Sanden E<lt>hv@crypt.compulink.co.ukE<gt>
187 =head1 COPYRIGHT AND LICENSE
189 Copyright (C) 2002,2004 Tim Jenness, Christian Soeller, Hugo van der Sanden.
192 This library is free software; you can redistribute it and/or modify
193 it under the same terms as Perl itself.