File: 15-custom-export-spec.t

package info (click to toggle)
libtest-mockrandom-perl 1.01-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 256 kB
  • sloc: perl: 326; makefile: 2
file content (23 lines) | stat: -rwxr-xr-x 753 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Test::MockRandom
use strict;

use Test::More tests => 5;

#--------------------------------------------------------------------------#
# Test package overriding
#--------------------------------------------------------------------------#

use Test::MockRandom {
    'rand'   => [                { 'OverrideTest' => 'random' }, 'AnotherOverride' ],
    'srand'  => { 'OverrideTest' => 'seed' },
    'oneish' => __PACKAGE__,
};

can_ok( 'OverrideTest',    qw ( random seed ) );
can_ok( 'AnotherOverride', qw ( rand ) );
can_ok( __PACKAGE__,       qw ( oneish ) );

OverrideTest::seed( .5, oneish() );
is( OverrideTest::random(),  .5,       'testing OverrideTest::random()' );
is( AnotherOverride::rand(), oneish(), 'testing AnotherOverride::rand()' );