This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add tests for IVdf, UVuf, IV_MAX and UV_MAX
[perl5.git] / dist / Devel-PPPort / t / format.t
CommitLineData
1d175cda
MHM
1################################################################################
2#
3# !!!!! Do NOT edit this file directly! !!!!!
4#
5# Edit mktests.PL and/or parts/inc/format instead.
6#
7# This file was automatically generated from the definition files in the
8# parts/inc/ subdirectory by mktests.PL. To learn more about how all this
9# works, please read the F<HACKERS> file that came with this distribution.
10#
11################################################################################
12
13BEGIN {
14 if ($ENV{'PERL_CORE'}) {
15 chdir 't' if -d 't';
0ff33da8 16 @INC = ('../lib', '../ext/Devel-PPPort/t') if -d '../lib' && -d '../ext';
1d175cda
MHM
17 require Config; import Config;
18 use vars '%Config';
19 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
20 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
21 exit 0;
22 }
23 }
24 else {
25 unshift @INC, 't';
26 }
27
28 sub load {
29 eval "use Test";
30 require 'testutil.pl' if $@;
31 }
32
bc4230ed 33 if (5) {
1d175cda 34 load();
bc4230ed 35 plan(tests => 5);
1d175cda
MHM
36 }
37}
38
39use Devel::PPPort;
40use strict;
91900b62 41BEGIN { $^W = 1; }
1d175cda
MHM
42
43package Devel::PPPort;
44use vars '@ISA';
45require DynaLoader;
46@ISA = qw(DynaLoader);
47bootstrap Devel::PPPort;
48
49package main;
50
bc4230ed
P
51use Config;
52
1d175cda
MHM
53my $num = 1.12345678901234567890;
54
55eval { Devel::PPPort::croak_NVgf($num) };
56ok($@ =~ /^1.1234567890/);
57
bc4230ed
P
58ok(Devel::PPPort::sprintf_iv(-8), 'XX_-8_XX');
59ok(Devel::PPPort::sprintf_uv(15), 'XX_15_XX');
60
61my $ivsize = $Config::Config{ivsize};
62my $ivmax = ($ivsize == 4) ? '2147483647' : ($ivsize == 8) ? '9223372036854775807' : 0;
63my $uvmax = ($ivsize == 4) ? '4294967295' : ($ivsize == 8) ? '18446744073709551615' : 0;
64if ($ivmax == 0) {
65 skip 'skip: unknown ivsize', 0 for 1..2;
66} else {
67 ok(Devel::PPPort::sprintf_ivmax(), $ivmax);
68 ok(Devel::PPPort::sprintf_uvmax(), $uvmax);
69}
70