"Fossies" - the Fresh Open Source Software Archive

Member "RPerl-5.002000/t/04_type_scalar.t" (30 Aug 2019, 39029 Bytes) of package /linux/misc/RPerl-5.002000.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "04_type_scalar.t": 4.001000_vs_4.002000.

    1 #!/usr/bin/env perl
    2 
    3 # suppress 'WEXRP00: Found multiple rperl executables' due to blib/ & pre-existing installation(s)
    4 BEGIN { $ENV{RPERL_WARNINGS} = 0; }
    5 
    6 use strict;
    7 use warnings;
    8 use RPerl::AfterSubclass;
    9 our $VERSION = 0.008_000;
   10 
   11 ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls)  # USER DEFAULT 1: allow numeric values & print operator
   12 ## no critic qw(ProhibitStringySplit ProhibitInterpolationOfLiterals)  # DEVELOPER DEFAULT 2: allow string test values
   13 ## no critic qw(ProhibitStringyEval)  # SYSTEM DEFAULT 1: allow eval()
   14 ## no critic qw(RequireInterpolationOfMetachars)  # USER DEFAULT 2: allow single-quoted control characters & sigils
   15 ## no critic qw(RequireCheckingReturnValueOfEval)  # SYSTEM DEFAULT 4: allow eval() test code blocks
   16 
   17 use RPerl::Test;
   18 use RPerl::DataType::Integer qw(integer_typetest0 integer_typetest1);
   19 use RPerl::DataType::Number qw(number_typetest0 number_typetest1);
   20 use RPerl::DataType::String qw(string_typetest0 string_typetest1);
   21 use rperltypesconv;
   22 use rperltypes;  # types_enable()
   23 use Test::More tests => 310;
   24 use Test::Exception;
   25 use Test::Number::Delta;
   26 
   27 BEGIN {
   28     if ( $ENV{RPERL_VERBOSE} ) {
   29         Test::More::diag("[[[ Beginning Scalar Type Pre-Test Loading, RPerl Type System ]]]");
   30     }
   31     lives_and( sub { use_ok('RPerl::AfterSubclass'); }, q{use_ok('RPerl::AfterSubclass') lives} );
   32 
   33     foreach my string $type (qw(Integer Number String)) {
   34         lives_and( sub { use_ok( 'RPerl::DataType::' . $type . '_cpp' ); }, q{use_ok('RPerl::DataType::' . $type . '_cpp') lives} );
   35     }
   36 }
   37 
   38 # use Data::Dumper() to stringify a string
   39 #our string $string_dumperify = sub {  # NEED FIX: RPerl subroutines disabled here
   40 sub string_dumperify {
   41     ( my string $input_string ) = @_;
   42 
   43     #    RPerl::diag("in 04_type_scalar.t string_dumperify(), received have \$input_string =\n$input_string\n\n");
   44     $input_string = Dumper( [$input_string] );
   45     $input_string =~ s/^\s+|\s+$//xmsg;    # strip leading whitespace
   46     my @input_string_split = split "\n", $input_string;
   47     $input_string = $input_string_split[1];    # only select the data line
   48     return $input_string;
   49 }
   50 
   51 # [[[ PRIMARY RUNLOOP ]]]
   52 # [[[ PRIMARY RUNLOOP ]]]
   53 # [[[ PRIMARY RUNLOOP ]]]
   54 
   55 # loop 3 times, once for each mode: PERLOPS_PERLTYPES, PERLOPS_CPPTYPES, CPPOPS_CPPTYPES
   56 foreach my integer $mode_id ( sort keys %{$RPerl::MODES} ) {
   57 #for my $mode_id ( 1 .. 1 ) {  # TEMPORARY DEBUGGING CPPOPS_PERLTYPES ONLY
   58 
   59     # [[[ MODE SETUP ]]]
   60 #    RPerl::diag("in 04_type_scalar.t, top of for() loop, have \$mode_id = $mode_id\n");
   61     my scalartype_hashref $mode = $RPerl::MODES->{$mode_id};
   62     my string $ops          = $mode->{ops};
   63     my string $types        = $mode->{types};
   64     my string $mode_tagline = $ops . 'OPS_' . $types . 'TYPES';
   65     if ( $ENV{RPERL_VERBOSE} ) {
   66         Test::More::diag( '[[[ Beginning RPerl Scalar Type Tests, ' . $ops . ' Operations & ' . $types . ' Data Types' . ' ]]]' );
   67     }
   68 
   69 #    $RPerl::DEBUG = 1;
   70 #    RPerl::diag('have $ops = ' . $ops . "\n");
   71 #    RPerl::diag('have $types = ' . $types . "\n");
   72 #    RPerl::diag('have $mode_tagline = ' . $mode_tagline . "\n");
   73 
   74     lives_ok( sub { rperltypes::types_enable($types) }, q{mode '} . $ops . ' Operations & ' . $types . ' Data Types' . q{' enabled} );
   75 
   76     foreach my string $type (qw(Integer Number String)) {
   77         if ( $ops eq 'CPP' ) {
   78 
   79             # force reload
   80             delete $main::{ 'RPerl__DataType__' . $type . '__MODE_ID' };
   81 
   82             my $package = 'RPerl::DataType::' . $type . '_cpp';
   83             lives_and( sub { require_ok($package); }, 'require_ok(' . $package . ') lives' );
   84 
   85             #            lives_and( sub { use_ok($package); }, 'use_ok(' . $package . ') lives' );
   86 
   87             lives_ok( sub { eval( $package . '::cpp_load();' ) }, $package . '::cpp_load() lives' );
   88         }
   89 
   90         lives_ok( sub { main->can( 'RPerl__DataType__' . $type . '__MODE_ID' ) }, 'main::RPerl__DataType__' . $type . '__MODE_ID() exists' );
   91 
   92         # NEED ANSWER: why does direct-calling *MODE_ID() always return 0, but main->can(...) and eval(...) returns correct values?
   93         #        RPerl::diag('have $type = ' . $type . "\n");
   94         #        my string $eval_string = 'main::RPerl__DataType__' . $type . '__MODE_ID();';
   95         #        RPerl::diag('have $eval_string = ' . $eval_string . "\n");
   96         #        my string $eval_retval = eval($eval_string);
   97         #        RPerl::diag('have $eval_retval = ' . $eval_retval . "\n");
   98         #        RPerl::diag(q{have main::RPerl__DataType__Integer__MODE_ID() = '} . main::RPerl__DataType__Integer__MODE_ID() . "'\n");
   99         #        RPerl::diag(q{have main::RPerl__DataType__Number__MODE_ID() = '} . main::RPerl__DataType__Number__MODE_ID() . "'\n");
  100         #        RPerl::diag(q{have main::RPerl__DataType__String__MODE_ID() = '} . main::RPerl__DataType__String__MODE_ID() . "'\n");
  101  
  102 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have $RPerl::MODES = ' . "\n" . Dumper($RPerl::MODES) . "\n");
  103 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have RPerl__DataType__ . $type . __MODE_ID = ' . 'RPerl__DataType__' . $type . '__MODE_ID' . "\n");
  104 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have main::RPerl__DataType__Integer__MODE_ID() = ' . main::RPerl__DataType__Integer__MODE_ID() . "\n");
  105 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have eval(main::RPerl__DataType__Integer__MODE_ID()) = ' . eval('main::RPerl__DataType__Integer__MODE_ID()') . "\n");
  106 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have main->can(...) = ' . main->can( 'RPerl__DataType__Integer__MODE_ID' ) . "\n");
  107 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have main->can(...)->() = ' . main->can( 'RPerl__DataType__Integer__MODE_ID' )->() . "\n");
  108 #RPerl::diag('in 04_type_scalar.t, top of for() loop, have Dumper(\%main::) = ' . Dumper(\%main::) . "\n");
  109 
  110         lives_and(
  111             sub {
  112                 is( $RPerl::MODES->{ main->can( 'RPerl__DataType__' . $type . '__MODE_ID' )->() }->{types},
  113                     $types, 'main::RPerl__DataType__' . $type . '__MODE_ID() types returns ' . $types );
  114             },
  115             'main::RPerl__DataType__' . $type . '__MODE_ID() lives'
  116         );
  117     }
  118 
  119     # [[[ INTEGER TESTS ]]]
  120     # [[[ INTEGER TESTS ]]]
  121     # [[[ INTEGER TESTS ]]]
  122 
  123     throws_ok(    # TIV00
  124         sub { integer_to_string() },
  125         "/(EIV00.*$mode_tagline)|(Usage.*integer_to_string)/",    # DEV NOTE: 2 different error messages, RPerl & C
  126         q{TIV00 integer_to_string() throws correct exception}
  127     );
  128     throws_ok(                                                    # TIV01
  129         sub { integer_to_string(undef) },
  130         "/EIV00.*$mode_tagline/",
  131         q{TIV01 integer_to_string(undef) throws correct exception}
  132     );
  133     lives_and(                                                    # TIV02
  134         sub {
  135             is( integer_to_string(0), '0', q{TIV02 integer_to_string(0) returns correct value} );
  136         },
  137         q{TIV02 integer_to_string(0) lives}
  138     );
  139     lives_and(                                                    # TIV03
  140         sub {
  141             is( integer_to_string(-0), '0', q{TIV03 integer_to_string(-0) returns correct value} );
  142         },
  143         q{TIV03 integer_to_string(-0) lives}
  144     );
  145     lives_and(                                                    # TIV04
  146         sub {
  147             is( integer_to_string(3), '3', q{TIV04 integer_to_string(3) returns correct value} );
  148         },
  149         q{TIV04 integer_to_string(3) lives}
  150     );
  151     lives_and(                                                    # TIV05
  152         sub {
  153             is( integer_to_string(-17), '-17', q{TIV05 integer_to_string(-17) returns correct value} );
  154         },
  155         q{TIV05 integer_to_string(-17) lives}
  156     );
  157     throws_ok(                                                    # TIV06
  158         sub { integer_to_string(-17.3) },
  159         "/EIV01.*$mode_tagline/",
  160         q{TIV06 integer_to_string(-17.3) throws correct exception}
  161     );
  162     throws_ok(                                                    # TIV07
  163         sub { integer_to_string('-17.3') },
  164         "/EIV01.*$mode_tagline/",
  165         q{TIV07 integer_to_string('-17.3') throws correct exception}
  166     );
  167     throws_ok(                                                    # TIV08
  168         sub { integer_to_string( [3] ) },
  169         "/EIV01.*$mode_tagline/",
  170         q{TIV08 integer_to_string([3]) throws correct exception}
  171     );
  172     throws_ok(                                                    # TIV09
  173         sub { integer_to_string( { a_key => 3 } ) },
  174         "/EIV01.*$mode_tagline/",
  175         q{TIV09 integer_to_string({a_key => 3}) throws correct exception}
  176     );
  177     lives_and(                                                    # TIV10
  178         sub {
  179             is( integer_to_string(34_567_890), '34_567_890', q{TIV10 integer_to_string(34_567_890) returns correct value} );
  180         },
  181         q{TIV10 integer_to_string(34_567_890) lives}
  182     );
  183     lives_and(                                                    # TIV11
  184         sub {
  185             is( integer_to_string(-34_567_890), '-34_567_890', q{TIV11 integer_to_string(-34_567_890) returns correct value} );
  186         },
  187         q{TIV11 integer_to_string(-34_567_890) lives}
  188     );
  189     lives_and(                                                    # TIV12
  190         sub {
  191             is( integer_to_string(234_567_890), '234_567_890', q{TIV12 integer_to_string(234_567_890) returns correct value} );
  192         },
  193         q{TIV12 integer_to_string(234_567_890) lives}
  194     );
  195     lives_and(                                                    # TIV13
  196         sub {
  197             is( integer_to_string(-234_567_890), '-234_567_890', q{TIV13 integer_to_string(-234_567_890) returns correct value} );
  198         },
  199         q{TIV13 integer_to_string(-234_567_890) lives}
  200     );
  201     lives_and(                                                    # TIV14
  202         sub {
  203             is( integer_to_string(1_234_567_890), '1_234_567_890', q{TIV14 integer_to_string(1_234_567_890) returns correct value} );
  204         },
  205         q{TIV14 integer_to_string(1_234_567_890) lives}
  206     );
  207     lives_and(                                                    # TIV15
  208         sub {
  209             is( integer_to_string(-1_234_567_890), '-1_234_567_890', q{TIV15 integer_to_string(-1_234_567_890) returns correct value} );
  210         },
  211         q{TIV15 integer_to_string(-1_234_567_890) lives}
  212     );
  213     throws_ok(                                                    # TIV16
  214         sub {
  215             integer_to_string(-1_234_567_890_000_000_000_000_000_000_000_000);
  216         },
  217         "/EIV01.*$mode_tagline/",
  218         q{TIV16 integer_to_string(-1_234_567_890_000_000_000_000_000_000_000_000) throws correct exception}
  219     );
  220     lives_and(                                                    # TIV20
  221         sub {
  222             is( integer_typetest0(), ( 3 + $mode_id ), q{TIV20 integer_typetest0() returns correct value} );
  223         },
  224         q{TIV20 integer_typetest0() lives}
  225     );
  226     throws_ok(                                                    # TIV30
  227         sub { integer_typetest1() },
  228         "/(EIV00.*$mode_tagline)|(Usage.*integer_typetest1)/"
  229         ,                                                         # DEV NOTE: 2 different error messages, RPerl & C
  230         q{TIV30 integer_typetest1() throws correct exception}
  231     );
  232     throws_ok(                                                    # TIV31
  233         sub { integer_typetest1(undef) },
  234         "/EIV00.*$mode_tagline/",
  235         q{TIV31 integer_typetest1(undef) throws correct exception}
  236     );
  237     lives_and(                                                    # TIV32
  238         sub {
  239             is( integer_typetest1(3), ( ( 3 * 2 ) + $mode_id ), q{TIV32 integer_typetest1(3) returns correct value} );
  240         },
  241         q{TIV32 integer_typetest1(3) lives}
  242     );
  243     lives_and(                                                    # TIV33
  244         sub {
  245             is( integer_typetest1(-17), ( ( -17 * 2 ) + $mode_id ), q{TIV33 integer_typetest1(-17) returns correct value} );
  246         },
  247         q{TIV33 integer_typetest1(-17) lives}
  248     );
  249     throws_ok(                                                    # TIV34
  250         sub { integer_typetest1(-17.3) },
  251         "/EIV01.*$mode_tagline/",
  252         q{TIV34 integer_typetest1(-17.3) throws correct exception}
  253     );
  254     throws_ok(                                                    # TIV35
  255         sub { integer_typetest1('-17.3') },
  256         "/EIV01.*$mode_tagline/",
  257         q{TIV35 integer_typetest1('-17.3') throws correct exception}
  258     );
  259     throws_ok(                                                    # TIV36
  260         sub { integer_typetest1( [3] ) },
  261         "/EIV01.*$mode_tagline/",
  262         q{TIV36 integer_typetest1([3]) throws correct exception}
  263     );
  264     throws_ok(                                                    # TIV37
  265         sub { integer_typetest1( { a_key => 3 } ) },
  266         "/EIV01.*$mode_tagline/",
  267         q{TIV37 integer_typetest1({a_key => 3}) throws correct exception}
  268     );
  269     lives_and(                                                    # TIV38
  270         sub {
  271             is( integer_typetest1(-234_567_890), ( ( -234_567_890 * 2 ) + $mode_id ), q{TIV38 integer_typetest1(-234_567_890) returns correct value} );
  272         },
  273         q{TIV38 integer_typetest1(-234_567_890) lives}
  274     );
  275     throws_ok(                                                    # TIV39
  276         sub {
  277             integer_typetest1(-1_234_567_890_000_000_000_000_000_000_000_000);
  278         },
  279         "/EIV01.*$mode_tagline/",
  280         q{TIV39 integer_typetest1(-1_234_567_890_000_000_000_000_000_000_000_000) throws correct exception}
  281     );
  282 
  283     # [[[ NUMBER TESTS ]]]
  284     # [[[ NUMBER TESTS ]]]
  285     # [[[ NUMBER TESTS ]]]
  286 
  287     throws_ok(    # TNV00
  288         sub { number_to_string() },
  289         "/(ENV00.*$mode_tagline)|(Usage.*number_to_string)/",    # DEV NOTE: 2 different error messages, RPerl & C
  290         q{TNV00 number_to_string() throws correct exception}
  291     );
  292     throws_ok(                                                   # TNV01
  293         sub { number_to_string(undef) },
  294         "/ENV00.*$mode_tagline/",
  295         q{TNV01 number_to_string(undef) throws correct exception}
  296     );
  297     lives_and(                                                   # TNV02
  298         sub {
  299             is( number_to_string(3), '3', q{TNV02 number_to_string(3) returns correct value} );
  300         },
  301         q{TNV02 number_to_string(3) lives}
  302     );
  303     lives_and(                                                   # TNV03
  304         sub {
  305             is( number_to_string(-17), '-17', q{TNV03 number_to_string(-17) returns correct value} );
  306         },
  307         q{TNV03 number_to_string(-17) lives}
  308     );
  309     lives_and(                                                   # TNV04
  310         sub {
  311             is( number_to_string(-17.3), '-17.3', q{TNV04 number_to_string(-17.3) returns correct value} );
  312         },
  313         q{TNV04 number_to_string(-17.3) lives}
  314     );
  315     throws_ok(                                                   # TNV05
  316         sub { number_to_string('-17.3') },
  317         "/ENV01.*$mode_tagline/",
  318         q{TNV05 number_to_string('-17.3') throws correct exception}
  319     );
  320     throws_ok(                                                   # TNV06
  321         sub { number_to_string( [3] ) },
  322         "/ENV01.*$mode_tagline/",
  323         q{TNV06 number_to_string([3]) throws correct exception}
  324     );
  325     throws_ok(                                                   # TNV07
  326         sub { number_to_string( { a_key => 3 } ) },
  327         "/ENV01.*$mode_tagline/",
  328         q{TNV07 number_to_string({a_key => 3}) throws correct exception}
  329     );
  330     lives_and(                                                   # TNV08
  331         sub {
  332             # NEED DELETE OLD CODE
  333 #            is( number_to_string(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9),
  334 #                '3.141_592_653_589_79',
  335             like( number_to_string(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9),
  336                 qr/3.141_592_653_589_7/,
  337                 q{TNV08 number_to_string(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9) returns correct value}
  338             );
  339         },
  340         q{TNV08 number_to_string(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9) lives}
  341     );
  342     lives_and(                                                   # TNV09
  343         sub {
  344             # NEED DELETE OLD CODE
  345 #            is( number_to_string(1_234_567.890_123_456), '1_234_567.890_123_46', q{TNV09 number_to_string(1_234_567.890_123_456) returns correct value} );
  346             like( number_to_string(1_234_567.890_123_456), qr/1_234_567.890_123_4/, q{TNV09 number_to_string(1_234_567.890_123_456) returns correct value} );
  347         },
  348         q{TNV09 number_to_string(1_234_567.890_123_456) lives}
  349     );
  350     lives_and(                                                   # TNV10
  351         sub {
  352             is( number_to_string(123_456_789.678_90), '123_456_789.678_9', q{TNV10 number_to_string(123_456_789.678_90) returns correct value} );
  353         },
  354         q{TNV10 number_to_string(123_456_789.678_90) lives}
  355     );
  356     lives_and(                                                   # TNV11
  357         sub {
  358             is( number_to_string(123_456_789.0), '123_456_789', q{TNV11 number_to_string(123_456_789.0) returns correct value} );
  359         },
  360         q{TNV11 number_to_string(123_456_789.0) lives}
  361     );
  362     lives_and(                                                   # TNV12
  363         sub {
  364             is( number_to_string(0.011_111_122_22), '0.011_111_122_22', q{TNV12 number_to_string(0.011_111_122_22) returns correct value} );
  365         },
  366         q{TNV12 number_to_string(0.011_111_122_22) lives}
  367     );
  368     lives_and(                                                   # TNV13
  369         sub {
  370             is( number_to_string(.011_111_122_22), '0.011_111_122_22', q{TNV13 number_to_string(.011_111_122_22) returns correct value} );
  371         },
  372         q{TNV13 number_to_string(.011_111_122_22) lives}
  373     );
  374     lives_and(                                                   # TNV14
  375         sub {
  376             is( number_to_string(-10.011_111_122_22), '-10.011_111_122_22', q{TNV14 number_to_string(-10.011_111_122_22) returns correct value} );
  377         },
  378         q{TNV14 number_to_string(-10.011_111_122_22) lives}
  379     );
  380     lives_and(                                                   # TNV15
  381         sub {
  382             is( number_to_string(-103.011_111_122_22), '-103.011_111_122_22', q{TNV15 number_to_string(-103.011_111_122_22) returns correct value} );
  383         },
  384         q{TNV15 number_to_string(-103.011_111_122_22) lives}
  385     );
  386     lives_and(                                                   # TNV20
  387         sub {
  388             delta_ok( number_typetest0(), ( 3.14285714285714 + $mode_id ),
  389                 q{TNV20 number_typetest0() returns correct value});
  390         },
  391         q{TNV20 number_typetest0() lives}
  392     );
  393     throws_ok(                                                                   # TNV30
  394         sub { number_typetest1() },
  395         "/(ENV00.*$mode_tagline)|(Usage.*number_typetest1)/"
  396         ,                                                                        # DEV NOTE: 2 different error messages, RPerl & C
  397         q{TNV30 number_typetest1() throws correct exception}
  398     );
  399     throws_ok(                                                                   # TNV31
  400         sub { number_typetest1(undef) },
  401         "/ENV00.*$mode_tagline/",
  402         q{TNV31 number_typetest1(undef) throws correct exception}
  403     );
  404     lives_and(                                                                   # TNV32
  405         sub {
  406             is( number_typetest1(3), ( ( 3 * 2 ) + $mode_id ), q{TNV32 number_typetest1(3) returns correct value} );
  407         },
  408         q{TNV32 number_typetest1(3) lives}
  409     );
  410     lives_and(                                                                   # TNV33
  411         sub {
  412             is( number_typetest1(-17), ( ( -17 * 2 ) + $mode_id ), q{TNV33 number_typetest1(-17) returns correct value} );
  413         },
  414         q{TNV33 number_typetest1(-17) lives}
  415     );
  416     lives_and(                                                                   # TNV34
  417         sub {
  418             # NEED DELETE OLD CODE
  419 #            is( number_typetest1(-17.3), ( ( -17.3 * 2 ) + $mode_id ), q{TNV34 number_typetest1(-17.3) returns correct value} );
  420             delta_ok( number_typetest1(-17.3), ( ( -17.3 * 2 ) + $mode_id ), q{TNV34 number_typetest1(-17.3) returns correct value} );
  421         },
  422         q{TNV34 number_typetest1(-17.3) lives}
  423     );
  424     throws_ok(                                                                   # TNV35
  425         sub { number_typetest1('-17.3') },
  426         "/ENV01.*$mode_tagline/",
  427         q{TNV35 number_typetest1('-17.3') throws correct exception}
  428     );
  429     throws_ok(                                                                   # TNV36
  430         sub { number_typetest1( [3] ) },
  431         "/ENV01.*$mode_tagline/",
  432         q{TNV36 number_typetest1([3]) throws correct exception}
  433     );
  434     throws_ok(                                                                   # TNV37
  435         sub { number_typetest1( { a_key => 3 } ) },
  436         "/ENV01.*$mode_tagline/",
  437         q{TNV37 number_typetest1({a_key => 3}) throws correct exception}
  438     );
  439     lives_and(                                                                   # TNV38
  440         sub {
  441             delta_ok(number_typetest1(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9),
  442                 ( ( 3.141_592_653_589_79 * 2 ) + $mode_id ),
  443                 q{TNV38 number_typetest1(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9) returns correct value}
  444             );
  445         },
  446         q{TNV38 number_typetest1(3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_9) lives}
  447     );
  448 
  449     # [[[ STRING TESTS ]]]
  450     # [[[ STRING TESTS ]]]
  451     # [[[ STRING TESTS ]]]
  452 
  453     throws_ok(    # TPV00
  454         sub { string_to_string() },
  455         "/(EPV00.*$mode_tagline)|(Usage.*string_to_string)/",    # DEV NOTE: 2 different error messages, RPerl & C
  456         q{TPV00 string_to_string() throws correct exception}
  457     );
  458     throws_ok(                                                   # TPV01
  459         sub { string_to_string(undef) },
  460         "/EPV00.*$mode_tagline/",
  461         q{TPV01 string_to_string(undef) throws correct exception}
  462     );
  463     throws_ok(                                                   # TPV02
  464         sub { string_to_string(3) },
  465         "/EPV01.*$mode_tagline/",
  466         q{TPV02 string_to_string(3) throws correct exception}
  467     );
  468     throws_ok(                                                   # TPV03
  469         sub { string_to_string(-17) },
  470         "/EPV01.*$mode_tagline/",
  471         q{TPV03 string_to_string(-17) throws correct exception}
  472     );
  473     throws_ok(                                                   # TPV04
  474         sub { string_to_string(-17.3) },
  475         "/EPV01.*$mode_tagline/",
  476         q{TPV04 string_to_string(-17.3) throws correct exception}
  477     );
  478     lives_and(                                                   # TPV05
  479         sub {
  480             is( string_to_string('-17.3'), "'-17.3'", q{TPV05 string_to_string('-17.3') returns correct value} );
  481         },
  482         q{TPV05 string_to_string('-17.3') lives}
  483     );
  484     throws_ok(                                                   # TPV06
  485         sub { string_to_string( [3] ) },
  486         "/EPV01.*$mode_tagline/",
  487         q{TPV06 string_to_string([3]) throws correct exception}
  488     );
  489     throws_ok(                                                   # TPV07
  490         sub { string_to_string( { a_key => 3 } ) },
  491         "/EPV01.*$mode_tagline/",
  492         q{TPV07 string_to_string({a_key => 3}) throws correct exception}
  493     );
  494     lives_and(                                                   # TPV08
  495         sub {
  496             is( string_to_string('Melange'), "'Melange'", q{TPV08 string_to_string('Melange') returns correct value} );
  497         },
  498         q{TPV08 string_to_string('Melange') lives}
  499     );
  500     lives_and(                                                   # TPV09
  501         sub {
  502             is( string_to_string("\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n"),
  503                 "'\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n'",
  504                 q{TPV09 string_to_string("\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n") returns correct value}
  505             );
  506         },
  507         q{TPV09 string_to_string("\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n") lives}
  508     );
  509 
  510     lives_and(                                                   # TPV10
  511         sub {
  512             is( string_to_string(
  513                     '\'I am a single-quoted string, in a single-quoted string with back-slash control chars\', the first string said introspectively.'
  514                 ),
  515                 string_dumperify(
  516                     '\'I am a single-quoted string, in a single-quoted string with back-slash control chars\', the first string said introspectively.'
  517                 ),
  518                 q{TPV10 string_to_string('\'I am a single-quoted string...\', the first string said introspectively.') returns correct value}
  519             );
  520         },
  521         q{TPV10 string_to_string('\'I am a single-quoted string...\', the first string said introspectively.') lives}
  522     );
  523     lives_and(    # TPV11
  524         sub {
  525             is( string_to_string('"I am a double-quoted string, in a single-quoted string with no back-slash chars", the second string observed.'),
  526                 string_dumperify('"I am a double-quoted string, in a single-quoted string with no back-slash chars", the second string observed.'),
  527                 q{TPV11 string_to_string('"I am a double-quoted string...", the second string observed.') returns correct value}
  528             );
  529         },
  530         q{TPV11 string_to_string('"I am a double-quoted string...", the second string observed.') lives}
  531     );
  532     lives_and(    # TPV12
  533         sub {
  534             is( string_to_string("'I am a single-quoted string, in a double-quoted string with no back-slash chars', the third string added."),
  535                 string_dumperify("'I am a single-quoted string, in a double-quoted string with no back-slash chars', the third string added."),
  536                 q{TPV12 string_to_string("'I am a single-quoted string...', the third string added.") returns correct value}
  537             );
  538         },
  539         q{TPV12 string_to_string("'I am a single-quoted string...', the third string added.") lives}
  540     );
  541     lives_and(    # TPV13
  542         sub {
  543             is( string_to_string("\"I am a double-quoted string, in a double-quoted string with back-slash control chars\", the fourth string offered."),
  544                 string_dumperify("\"I am a double-quoted string, in a double-quoted string with back-slash control chars\", the fourth string offered."),
  545                 q{TPV13 string_to_string("\"I am a double-quoted string...\", the fourth string offered.") returns correct value}
  546             );
  547         },
  548         q{TPV13 string_to_string("\"I am a double-quoted string...\", the fourth string offered.") lives}
  549     );
  550     lives_and(    # TPV14
  551         sub {
  552             is( string_to_string(
  553                     '\'I am a single-quoted string, in a single-quoted string with back-slash control and \ display \ chars\', the fifth string shouted.'
  554                 ),
  555                 string_dumperify(
  556                     '\'I am a single-quoted string, in a single-quoted string with back-slash control and \ display \ chars\', the fifth string shouted.'
  557                 ),
  558                 q{TPV14 string_to_string('\'I am a single-quoted string... and \ display \ chars\', the fifth string shouted.') returns correct value}
  559             );
  560         },
  561         q{TPV14 string_to_string('\'I am a single-quoted string... and \ display \ chars\', the fifth string shouted.') lives}
  562     );
  563     lives_and(    # TPV15
  564         sub {
  565             is( string_to_string('"I am a double-quoted string, in a single-quoted string with back-slash \ display \ chars", the sixth string hollered.'),
  566                 string_dumperify('"I am a double-quoted string, in a single-quoted string with back-slash \ display \ chars", the sixth string hollered.'),
  567                 q{TPV15 string_to_string('"I am a double-quoted string... \ display \ chars", the sixth string hollered.') returns correct value}
  568             );
  569         },
  570         q{TPV15 string_to_string('"I am a double-quoted string... \ display \ chars", the sixth string hollered.') lives}
  571     );
  572     lives_and(    # TPV16
  573         sub {
  574             is( string_to_string("'I am a single-quoted string, in a double-quoted string with back-slash \\ display \\ chars', the seventh string yelled."),
  575                 string_dumperify("'I am a single-quoted string, in a double-quoted string with back-slash \\ display \\ chars', the seventh string yelled."),
  576                 q{TPV16 string_to_string("'I am a single-quoted string... \\ display \\ chars', the seventh string yelled.") returns correct value}
  577             );
  578         },
  579         q{TPV16 string_to_string("'I am a single-quoted string... \\ display \\ chars', the seventh string yelled.") lives}
  580     );
  581     lives_and(    # TPV17
  582         sub {
  583             is( string_to_string(
  584                     "\"I am a double-quoted string, in a double-quoted string with back-slash control and \\ display \\ chars\", the eighth string belted."
  585                 ),
  586                 string_dumperify(
  587                     "\"I am a double-quoted string, in a double-quoted string with back-slash control and \\ display \\ chars\", the eighth string belted."
  588                 ),
  589                 q{TPV17 string_to_string("\"I am a double-quoted string... and \\ display \\ chars\", the eighth string belted.") returns correct value}
  590             );
  591         },
  592         q{TPV17 string_to_string("\"I am a double-quoted string... and \\ display \\ chars\", the eighth string belted.") lives}
  593     );
  594     lives_and(    # TPV20
  595         sub {
  596             is( string_to_string(q{'I am a single-quoted string, in a single-quoted q{} string with no back-slash chars', the ninth string chimed in.}),
  597                 string_dumperify(q{'I am a single-quoted string, in a single-quoted q{} string with no back-slash chars', the ninth string chimed in.}),
  598                 q{TPV20 string_to_string(q{'I am a single-quoted string...', the ninth string chimed in.}) returns correct value}
  599             );
  600         },
  601         q{TPV20 string_to_string(q{'I am a single-quoted string...', the ninth string chimed in.}) lives}
  602     );
  603     lives_and(    # TPV21
  604         sub {
  605             is( string_to_string(q{"I am a double-quoted string, in a single-quoted q{} string with no back-slash chars", the tenth string opined.}),
  606                 string_dumperify(q{"I am a double-quoted string, in a single-quoted q{} string with no back-slash chars", the tenth string opined.}),
  607                 q{TPV21 string_to_string(q{"I am a double-quoted string...", the tenth string opined.}) returns correct value}
  608             );
  609         },
  610         q{TPV21 string_to_string(q{"I am a double-quoted string...", the tenth string opined.}) lives}
  611     );
  612     lives_and(    # TPV22
  613         sub {
  614             is( string_to_string(qq{'I am a single-quoted string, in a double-quoted qq{} string with no back-slash chars', the eleventh string asserted.}),
  615                 string_dumperify(qq{'I am a single-quoted string, in a double-quoted qq{} string with no back-slash chars', the eleventh string asserted.}),
  616                 q{TPV22 string_to_string(qq{'I am a single-quoted string...', the eleventh string asserted.}) returns correct value}
  617             );
  618         },
  619         q{TPV22 string_to_string(qq{'I am a single-quoted string...', the eleventh string asserted.}) lives}
  620     );
  621     lives_and(    # TPV23
  622         sub {
  623             is( string_to_string(qq{"I am a double-quoted string, in a double-quoted qq{} string with no back-slash chars", the twelfth string insisted.}),
  624                 string_dumperify(qq{"I am a double-quoted string, in a double-quoted qq{} string with no back-slash chars", the twelfth string insisted.}),
  625                 q{TPV23 string_to_string(qq{"I am a double-quoted string...", the twelfth string insisted.}) returns correct value}
  626             );
  627         },
  628         q{TPV23 string_to_string(qq{"I am a double-quoted string...", the twelfth string insisted.}) lives}
  629     );
  630     lives_and(    # TPV24
  631         sub {
  632             is( string_to_string(
  633                     q{'I am a single-quoted string, in a single-quoted q{} string with back-slash \ display \ chars', the thirteenth string whispered.}
  634                 ),
  635                 string_dumperify(
  636                     q{'I am a single-quoted string, in a single-quoted q{} string with back-slash \ display \ chars', the thirteenth string whispered.}
  637                 ),
  638                 q{TPV24 string_to_string(q{'I am a single-quoted string... \ display \ chars', the thirteenth string whispered.}) returns correct value}
  639             );
  640         },
  641         q{TPV24 string_to_string(q{'I am a single-quoted string... \ display \ chars', the thirteenth string whispered.}) lives}
  642     );
  643     lives_and(    # TPV25
  644         sub {
  645             is( string_to_string(
  646                     q{"I am a double-quoted string, in a single-quoted q{} string with back-slash \ display \ chars", the fourteenth string breathed.}
  647                 ),
  648                 string_dumperify(
  649                     q{"I am a double-quoted string, in a single-quoted q{} string with back-slash \ display \ chars", the fourteenth string breathed.}
  650                 ),
  651                 q{TPV25 string_to_string(q{"I am a double-quoted string... \ display \ chars", the fourteenth string breathed.}) returns correct value}
  652             );
  653         },
  654         q{TPV25 string_to_string(q{"I am a double-quoted string... \ display \ chars", the fourteenth string breathed.}) lives}
  655     );
  656     lives_and(    # TPV26
  657         sub {
  658             is( string_to_string(
  659                     qq{'I am a single-quoted string, in a double-quoted qq{} string with back-slash \\ display \\ chars', the fifteenth string mouthed.}
  660                 ),
  661                 string_dumperify(
  662                     qq{'I am a single-quoted string, in a double-quoted qq{} string with back-slash \\ display \\ chars', the fifteenth string mouthed.}
  663                 ),
  664                 q{TPV26 string_to_string(qq{'I am a single-quoted string... back-slash \\ display \\ chars', the fifteenth string mouthed.}) returns correct value}
  665             );
  666         },
  667         q{TPV26 string_to_string(qq{'I am a single-quoted string... back-slash \\ display \\ chars', the fifteenth string mouthed.}) lives}
  668     );
  669     lives_and(    # TPV27
  670         sub {
  671             is( string_to_string(
  672                     qq{"I am a double-quoted string, in a double-quoted qq{} string with back-slash \\ display \\ chars", the sixteenth string implied.}
  673                 ),
  674                 string_dumperify(
  675                     qq{"I am a double-quoted string, in a double-quoted qq{} string with back-slash \\ display \\ chars", the sixteenth string implied.}
  676                 ),
  677                 q{TPV27 string_to_string(qq{"I am a double-quoted string... back-slash \\ display \\ chars", the sixteenth string implied.}) returns correct value}
  678             );
  679         },
  680         q{TPV27 string_to_string(qq{"I am a double-quoted string... back-slash \\ display \\ chars", the sixteenth string implied.}) lives}
  681     );
  682     lives_and(    # TPV30
  683         sub {
  684             is( string_typetest0(), "Spice $mode_tagline", q{TPV30 string_typetest0() returns correct value} );
  685         },
  686         q{TPV30 string_typetest0() lives}
  687     );
  688     throws_ok(    # TPV40
  689         sub { string_typetest1() },
  690         "/(EPV00.*$mode_tagline)|(Usage.*string_typetest1)/"
  691         ,         # DEV NOTE: 2 different error messages, RPerl & C
  692         q{TPV40 string_typetest1() throws correct exception}
  693     );
  694     throws_ok(    # TPV41
  695         sub { string_typetest1(undef) },
  696         "/EPV00.*$mode_tagline/",
  697         q{TPV41 string_typetest1(undef) throws correct exception}
  698     );
  699     throws_ok(    # TPV42
  700         sub { string_typetest1(3) },
  701         "/EPV01.*$mode_tagline/",
  702         q{TPV42 string_typetest1(3) throws correct exception}
  703     );
  704     throws_ok(    # TPV43
  705         sub { string_typetest1(-17) },
  706         "/EPV01.*$mode_tagline/",
  707         q{TPV43 string_typetest1(-17) throws correct exception}
  708     );
  709     throws_ok(    # TPV44
  710         sub { string_typetest1(-17.3) },
  711         "/EPV01.*$mode_tagline/",
  712         q{TPV44 string_typetest1(-17.3) throws correct exception}
  713     );
  714     lives_and(    # TPV45
  715         sub {
  716             is( string_typetest1('-17.3'), "'-17.3' $mode_tagline", q{TPV45 string_typetest1('-17.3') returns correct value} );
  717         },
  718         q{TPV45 string_typetest1('-17.3') lives}
  719     );
  720     throws_ok(    # TPV46
  721         sub { string_typetest1( [3] ) },
  722         "/EPV01.*$mode_tagline/",
  723         q{TPV46 string_typetest1([3]) throws correct exception}
  724     );
  725     throws_ok(    # TPV47
  726         sub { string_typetest1( { a_key => 3 } ) },
  727         "/EPV01.*$mode_tagline/",
  728         q{TPV47 string_typetest1({a_key => 3}) throws correct exception}
  729     );
  730     lives_and(    # TPV48
  731         sub {
  732             is( string_typetest1('Melange'), "'Melange' $mode_tagline", q{TPV48 string_typetest1('Melange') returns correct value} );
  733         },
  734         q{TPV48 string_typetest1('Melange') lives}
  735     );
  736     lives_and(    # TPV49
  737         sub {
  738             is( string_typetest1("\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n"),
  739                 "'\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n' $mode_tagline",
  740                 q{TPV49 string_typetest1("\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n") returns correct value}
  741             );
  742         },
  743         q{TPV49 string_typetest1("\nThe Spice Extends Life\nThe Spice Expands Consciousness\nThe Spice Is Vital To Space Travel\n") lives}
  744     );
  745 }
  746 
  747 done_testing();