Permalink
Browse files

[t] Improve QRNG test descriptions

The motivation for this is to have better information to diagnose this failing
CPANTesters report on OpenBSD:

http://www.cpantesters.org/cpan/report/c29c6cf6-dfe7-11e2-8c80-50d7c5c10595
  • Loading branch information...
1 parent 3bda95a commit 3cfd44a6c703795b6a37656661167b0ca7564c85 @leto committed Jun 29, 2013
Showing with 13 additions and 7 deletions.
  1. +13 −7 t/QRNG.t
View
@@ -23,23 +23,28 @@ sub GSL_QRNG_ALLOC : Tests {
}
sub GSL_QRNG_STATE_SIZE : Tests {
- my $self = shift;
- my $state = gsl_qrng_state($self->{sobol});
- my $size = gsl_qrng_size($self->{sobol});
- ok( defined $state && $state >0 , 'gsl_qrng_state' );
- ok( defined $size && $size > 0, 'gsl_qrng_size' );
+ my $self = shift;
+ my $state = gsl_qrng_state($self->{sobol});
+ my $size = gsl_qrng_size($self->{sobol});
+
+ ok( defined $state, "state is defined");
+ cmp_ok($state,'>',0 , 'state is positive and non-zero');
+
+ ok( defined $size, "size is defined");
+ cmp_ok($size,'>',0 , 'size is positive and non-zero');
+
}
sub GSL_QRNG_CLONE : Tests {
- my $self = shift;
+ my $self = shift;
my $droid = gsl_qrng_clone($self->{sobol});
isa_ok($droid, 'Math::GSL::QRNG' );
}
sub GSL_QRNG_NAME : Tests {
my $self = shift;
my $name = gsl_qrng_name($self->{sobol});
- ok ($name eq 'sobol', 'gsl_qrng_name' );
+ cmp_ok($name,'eq','sobol', 'gsl_qrng_name == sobol' );
}
sub GSL_QRNG_GET : Tests {
@@ -48,6 +53,7 @@ sub GSL_QRNG_GET : Tests {
is ($status, $GSL_SUCCESS);
ok_similar( [ 0.5, 0.5 ], \@values, 'gsl_qrng_get returns multiple values' );
+
($status, @values)= gsl_qrng_get($self->{sobol});
ok_similar( [ 0.75, 0.25 ], \@values, 'gsl_qrng_get returns correct values for sobol' );
}

0 comments on commit 3cfd44a

Please sign in to comment.