| 1 | package XS::APItest; |
| 2 | |
| 3 | use 5.008; |
| 4 | use strict; |
| 5 | use warnings; |
| 6 | use Carp; |
| 7 | |
| 8 | use base qw/ DynaLoader Exporter /; |
| 9 | |
| 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. |
| 13 | |
| 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 |
| 17 | ); |
| 18 | |
| 19 | our $VERSION = '0.01'; |
| 20 | |
| 21 | bootstrap XS::APItest $VERSION; |
| 22 | |
| 23 | 1; |
| 24 | __END__ |
| 25 | |
| 26 | =head1 NAME |
| 27 | |
| 28 | XS::APItest - Test the perl C API |
| 29 | |
| 30 | =head1 SYNOPSIS |
| 31 | |
| 32 | use XS::APItest; |
| 33 | print_double(4); |
| 34 | |
| 35 | =head1 ABSTRACT |
| 36 | |
| 37 | This module tests the perl C API. Currently tests that C<printf> |
| 38 | works correctly. |
| 39 | |
| 40 | =head1 DESCRIPTION |
| 41 | |
| 42 | This module can be used to check that the perl C API is behaving |
| 43 | correctly. This module provides test functions and an associated |
| 44 | test script that verifies the output. |
| 45 | |
| 46 | This module is not meant to be installed. |
| 47 | |
| 48 | =head2 EXPORT |
| 49 | |
| 50 | Exports all the test functions: |
| 51 | |
| 52 | =over 4 |
| 53 | |
| 54 | =item B<print_double> |
| 55 | |
| 56 | Test that a double-precision floating point number is formatted |
| 57 | correctly by C<printf>. |
| 58 | |
| 59 | print_double( $val ); |
| 60 | |
| 61 | Output is sent to STDOUT. |
| 62 | |
| 63 | =item B<print_long_double> |
| 64 | |
| 65 | Test that a C<long double> is formatted correctly by |
| 66 | C<printf>. Takes no arguments - the test value is hard-wired |
| 67 | into the function (as "7"). |
| 68 | |
| 69 | print_long_double(); |
| 70 | |
| 71 | Output is sent to STDOUT. |
| 72 | |
| 73 | =item B<have_long_double> |
| 74 | |
| 75 | Determine whether a C<long double> is supported by Perl. This should |
| 76 | be used to determine whether to test C<print_long_double>. |
| 77 | |
| 78 | print_long_double() if have_long_double; |
| 79 | |
| 80 | =item B<print_nv> |
| 81 | |
| 82 | Test that an C<NV> is formatted correctly by |
| 83 | C<printf>. |
| 84 | |
| 85 | print_nv( $val ); |
| 86 | |
| 87 | Output is sent to STDOUT. |
| 88 | |
| 89 | =item B<print_iv> |
| 90 | |
| 91 | Test that an C<IV> is formatted correctly by |
| 92 | C<printf>. |
| 93 | |
| 94 | print_iv( $val ); |
| 95 | |
| 96 | Output is sent to STDOUT. |
| 97 | |
| 98 | =item B<print_uv> |
| 99 | |
| 100 | Test that an C<UV> is formatted correctly by |
| 101 | C<printf>. |
| 102 | |
| 103 | print_uv( $val ); |
| 104 | |
| 105 | Output is sent to STDOUT. |
| 106 | |
| 107 | =item B<print_int> |
| 108 | |
| 109 | Test that an C<int> is formatted correctly by |
| 110 | C<printf>. |
| 111 | |
| 112 | print_int( $val ); |
| 113 | |
| 114 | Output is sent to STDOUT. |
| 115 | |
| 116 | =item B<print_long> |
| 117 | |
| 118 | Test that an C<long> is formatted correctly by |
| 119 | C<printf>. |
| 120 | |
| 121 | print_long( $val ); |
| 122 | |
| 123 | Output is sent to STDOUT. |
| 124 | |
| 125 | =item B<print_float> |
| 126 | |
| 127 | Test that a single-precision floating point number is formatted |
| 128 | correctly by C<printf>. |
| 129 | |
| 130 | print_float( $val ); |
| 131 | |
| 132 | Output is sent to STDOUT. |
| 133 | |
| 134 | =back |
| 135 | |
| 136 | =head1 SEE ALSO |
| 137 | |
| 138 | L<XS::Typemap>, L<perlapi>. |
| 139 | |
| 140 | =head1 AUTHORS |
| 141 | |
| 142 | Tim Jenness, E<lt>t.jenness@jach.hawaii.eduE<gt>, |
| 143 | Christian Soeller, E<lt>csoelle@mph.auckland.ac.nzE<gt>, |
| 144 | Hugo van der Sanden E<lt>hv@crypt.compulink.co.ukE<gt> |
| 145 | |
| 146 | =head1 COPYRIGHT AND LICENSE |
| 147 | |
| 148 | Copyright (C) 2002 Tim Jenness, Christian Soeller, Hugo van der Sanden. |
| 149 | All Rights Reserved. |
| 150 | |
| 151 | This library is free software; you can redistribute it and/or modify |
| 152 | it under the same terms as Perl itself. |
| 153 | |
| 154 | =cut |