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