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