Permalink
Browse files

Test all execution paths for _set_floatval_range().

  • Loading branch information...
1 parent e2c061d commit 7486fbc5a43fe0ccd70171819959d8780477ca7d @jkeenan jkeenan committed with Jan 25, 2012
Showing with 47 additions and 1 deletion.
  1. +47 −1 t/steps/auto/sizes-01.t
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More tests => 31;
use Carp;
#use Data::Dumper;$Data::Dumper::Indent=1;
use lib qw( lib t/configure/testlib );
@@ -37,6 +37,8 @@ my $step = test_step_constructor_and_description($conf);
my $ret = $step->runstep($conf);
ok( $ret, "runstep() returned true value" );
+##### _set_intval_range #####
+
{
$conf->data->set('iv' => 'short');
auto::sizes::_set_intval_range($conf);
@@ -160,6 +162,50 @@ ok( $ret, "runstep() returned true value" );
$conf->data->set( intvalmax => undef );
}
+##### _set_floatval_range #####
+
+{
+ $conf->data->set('nv' => 'float');
+ auto::sizes::_set_floatval_range($conf);
+ is( $conf->data->get( 'floatvalmin' ), 'FLT_MIN',
+ "_set_floatval_range(): got expected floatvalmin" );
+ is( $conf->data->get( 'floatvalmax' ), 'FLT_MAX',
+ "_set_floatval_range(): got expected floatvalmax" );
+
+ # prepare for next set of tests
+ $conf->data->set( iv => undef );
+ $conf->data->set( intvalmin => undef );
+ $conf->data->set( intvalmax => undef );
+}
+
+{
+ $conf->data->set('nv' => 'double');
+ auto::sizes::_set_floatval_range($conf);
+ is( $conf->data->get( 'floatvalmin' ), 'DBL_MIN',
+ "_set_floatval_range(): got expected floatvalmin" );
+ is( $conf->data->get( 'floatvalmax' ), 'DBL_MAX',
+ "_set_floatval_range(): got expected floatvalmax" );
+
+ # prepare for next set of tests
+ $conf->data->set( iv => undef );
+ $conf->data->set( intvalmin => undef );
+ $conf->data->set( intvalmax => undef );
+}
+
+{
+ $conf->data->set('nv' => 'long double');
+ auto::sizes::_set_floatval_range($conf);
+ is( $conf->data->get( 'floatvalmin' ), 'LDBL_MIN',
+ "_set_floatval_range(): got expected floatvalmin" );
+ is( $conf->data->get( 'floatvalmax' ), 'LDBL_MAX',
+ "_set_floatval_range(): got expected floatvalmax" );
+
+ # prepare for next set of tests
+ $conf->data->set( iv => undef );
+ $conf->data->set( intvalmin => undef );
+ $conf->data->set( intvalmax => undef );
+}
+
{
my $nv = 'foobar';
$conf->data->set( nv => $nv );

0 comments on commit 7486fbc

Please sign in to comment.