chiark / gitweb /
f694959e7e10621b8228bbc3e9a6bbb471b7b79c
[nailing-cargo.git] / t / toml-test / valid / long-float.t
1 # File automatically generated from BurntSushi/toml-test
2 use utf8;
3 use Test2::V0;
4 use Data::Dumper;
5 use TOML::Tiny;
6
7 binmode STDIN,  ':encoding(UTF-8)';
8 binmode STDOUT, ':encoding(UTF-8)';
9
10 my $expected1 = {
11                'neglongpi' => bless( {
12                                        'name' => '<Custom Code>',
13                                        'operator' => 'CODE(...)',
14                                        '_lines' => [
15                                                      6
16                                                    ],
17                                        'code' => sub {
18                                                      BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15\x00\x04\x40\x05\x04\x54"}
19                                                      use strict;
20                                                      no feature ':all';
21                                                      use feature ':5.16';
22                                                      require Math::BigFloat;
23                                                      'Math::BigFloat'->new('-3.141592653589793')->beq($_);
24                                                  },
25                                        '_file' => '(eval 420)'
26                                      }, 'Test2::Compare::Custom' ),
27                'longpi' => bless( {
28                                     '_lines' => [
29                                                   6
30                                                 ],
31                                     'code' => sub {
32                                                   BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15\x00\x04\x40\x05\x04\x54"}
33                                                   use strict;
34                                                   no feature ':all';
35                                                   use feature ':5.16';
36                                                   require Math::BigFloat;
37                                                   'Math::BigFloat'->new('3.141592653589793')->beq($_);
38                                               },
39                                     'operator' => 'CODE(...)',
40                                     'name' => '<Custom Code>',
41                                     '_file' => '(eval 421)'
42                                   }, 'Test2::Compare::Custom' )
43              };
44
45
46 my $actual = from_toml(q{longpi = 3.141592653589793
47 neglongpi = -3.141592653589793
48 });
49
50 is($actual, $expected1, 'long-float - from_toml') or do{
51   diag 'EXPECTED:';
52   diag Dumper($expected1);
53
54   diag 'ACTUAL:';
55   diag Dumper($actual);
56 };
57
58 is(eval{ from_toml(to_toml($actual)) }, $actual, 'long-float - to_toml') or do{
59   diag 'INPUT:';
60   diag Dumper($actual);
61
62   diag 'TOML OUTPUT:';
63   diag to_toml($actual);
64
65   diag 'REPARSED OUTPUT:';
66   diag Dumper(from_toml(to_toml($actual)));
67 };
68
69 done_testing;