1XS::APItest(3pm) Perl Programmers Reference Guide XS::APItest(3pm)
2
3
4
6 XS::APItest - Test the perl C API
7
9 use XS::APItest;
10 print_double(4);
11
13 This module tests the perl C API. Currently tests that "printf" works
14 correctly.
15
17 This module can be used to check that the perl C API is behaving
18 correctly. This module provides test functions and an associated test
19 script that verifies the output.
20
21 This module is not meant to be installed.
22
23 EXPORT
24 Exports all the test functions:
25
26 print_double
27 Test that a double-precision floating point number is formatted
28 correctly by "printf".
29
30 print_double( $val );
31
32 Output is sent to STDOUT.
33
34 print_long_double
35 Test that a "long double" is formatted correctly by "printf". Takes
36 no arguments - the test value is hard-wired into the function (as
37 "7").
38
39 print_long_double();
40
41 Output is sent to STDOUT.
42
43 have_long_double
44 Determine whether a "long double" is supported by Perl. This
45 should be used to determine whether to test "print_long_double".
46
47 print_long_double() if have_long_double;
48
49 print_nv
50 Test that an "NV" is formatted correctly by "printf".
51
52 print_nv( $val );
53
54 Output is sent to STDOUT.
55
56 print_iv
57 Test that an "IV" is formatted correctly by "printf".
58
59 print_iv( $val );
60
61 Output is sent to STDOUT.
62
63 print_uv
64 Test that an "UV" is formatted correctly by "printf".
65
66 print_uv( $val );
67
68 Output is sent to STDOUT.
69
70 print_int
71 Test that an "int" is formatted correctly by "printf".
72
73 print_int( $val );
74
75 Output is sent to STDOUT.
76
77 print_long
78 Test that an "long" is formatted correctly by "printf".
79
80 print_long( $val );
81
82 Output is sent to STDOUT.
83
84 print_float
85 Test that a single-precision floating point number is formatted
86 correctly by "printf".
87
88 print_float( $val );
89
90 Output is sent to STDOUT.
91
92 call_sv, call_pv, call_method
93 These exercise the C calls of the same names. Everything after the
94 flags arg is passed as the the args to the called function. They
95 return whatever the C function itself pushed onto the stack, plus
96 the return value from the function; for example
97
98 call_sv( sub { @_, 'c' }, G_ARRAY, 'a', 'b'); # returns 'a', 'b', 'c', 3
99 call_sv( sub { @_ }, G_SCALAR, 'a', 'b'); # returns 'b', 1
100
101 eval_sv
102 Evaluates the passed SV. Result handling is done the same as for
103 "call_sv()" etc.
104
105 eval_pv
106 Exercises the C function of the same name in scalar context.
107 Returns the same SV that the C function returns.
108
109 require_pv
110 Exercises the C function of the same name. Returns nothing.
111
113 XS::Typemap, perlapi.
114
116 Tim Jenness, <t.jenness@jach.hawaii.edu>, Christian Soeller,
117 <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden
118 <hv@crypt.compulink.co.uk>
119
121 Copyright (C) 2002,2004 Tim Jenness, Christian Soeller, Hugo van der
122 Sanden. All Rights Reserved.
123
124 This library is free software; you can redistribute it and/or modify it
125 under the same terms as Perl itself.
126
127
128
129perl v5.10.1 2009-04-14 XS::APItest(3pm)