~ubuntu-branches/ubuntu/trusty/pdl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/limits_trans.t

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2005-10-09 21:25:50 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20051009212550-5uri1xdwwpswy3zu
Tags: 1:2.4.2-3ubuntu1
debian/control: added libgl1-mesa-dev and libglu1-mesa-dev to build deps
(GL/GLU Transition)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
use Test::More;
 
3
use PDL;
 
4
 
 
5
BEGIN {
 
6
  eval "use PDL::Slatec;";
 
7
  if ( !$@ ) {
 
8
    eval "use PDL::Graphics::Limits;";
 
9
    plan tests => 8;
 
10
  } else {
 
11
    plan skip_all => 'PDL::Slatec not available';
 
12
  }
 
13
};
 
14
 
 
15
$x1 = pdl( 1, 2, 3 );
 
16
$x2 = pdl( 2, 3, 4 );
 
17
 
 
18
$y1 = pdl( 10, 3, 4 );
 
19
$y2 = pdl( -1, 2, 4 );
 
20
 
 
21
sub trans { $_[0] * 10 };
 
22
sub trans2 { $_[0] * 11 };
 
23
 
 
24
@udsets = ( [ $x1, [ $y1, \&trans ]], [ $x2, $y2 ] );
 
25
@limits = limits( @udsets, { Bounds => 'MinMax', Clean => 'None' } );
 
26
ok( eq_array( \@limits, [ 1, 4, -1, 100 ] ), 'array: y1 trans' );
 
27
 
 
28
@udsets = ( [ $x1, $y1], [ $x2, $y2 ] );
 
29
@limits = limits( @udsets, { Trans => [ undef, \&trans ],
 
30
                           Bounds => 'MinMax',
 
31
                           Clean => 'None' } );
 
32
ok( eq_array( \@limits, [ 1, 4, -10, 100 ] ), 'array: y* trans' );
 
33
 
 
34
@udsets = ( [ $x1, [ $y1, undef, undef, undef ] ], [ $x2, $y2 ] );
 
35
@limits = limits( @udsets, { Trans => [ undef, \&trans ],
 
36
                           Bounds => 'MinMax',
 
37
                           Clean => 'None' } );
 
38
ok( eq_array( \@limits, [ 1, 4, -10, 40 ] ), 'array: y* trans, y1 undef' );
 
39
 
 
40
@udsets = ( [ $x1, [ $y1, \&trans ]], [ $x2, [ $y2, \&trans2 ]] );
 
41
@limits = limits( @udsets, { Bounds => 'MinMax', Clean => 'None' } );
 
42
ok( eq_array( \@limits, [ 1, 4, -11, 100 ] ), 'array: y1 trans y2 trans2' );
 
43
 
 
44
############################################################
 
45
 
 
46
@udsets = ([ { x => $x1, y => $y1, ytrans => \&trans }, { x => $x2, y => $y2 } ]);
 
47
@limits = limits( @udsets, { Bounds => 'MinMax', Clean => 'None',
 
48
                           VecKeys => [qw( x y&ytrans )], KeyCroak => 0
 
49
                         } );
 
50
ok( eq_array( \@limits, [ 1, 4, -1, 100 ] ), 'hash: y1 trans' );
 
51
 
 
52
@udsets = ([ { x => $x1, y => $y1 }, { x => $x2, y => $y2 } ]);
 
53
@limits = limits( @udsets, { Bounds => 'MinMax', Clean => 'None',
 
54
                           VecKeys => [qw( x y )], 
 
55
                           Trans => [ undef, \&trans ]
 
56
                         } );
 
57
ok( eq_array( \@limits, [ 1, 4, -10, 100 ] ), 'hash: y* trans' );
 
58
 
 
59
@udsets = ([ { x => $x1, y => $y1, ytrans => undef },
 
60
             { x => $x2, y => $y2 } ]);
 
61
@limits = limits( @udsets, { Bounds => 'MinMax', Clean => 'None',
 
62
                           VecKeys => [qw( x y&ytrans )], KeyCroak => 0,
 
63
                           Trans => [ undef, \&trans ],
 
64
                         } );
 
65
ok( eq_array( \@limits, [ 1, 4, -10, 40 ] ), 'hash: y* trans y1 undef' );
 
66
 
 
67
@udsets = ([ { x => $x1, y => $y1, ytrans => \&trans },
 
68
             { x => $x2, y => $y2, ytrans => \&trans2 } ]);
 
69
@limits = limits( @udsets, { Bounds => 'MinMax', Clean => 'None',
 
70
                           VecKeys => [qw( x y&ytrans )],
 
71
                         } );
 
72
ok( eq_array( \@limits, [ 1, 4, -11, 100 ] ), 'hash: y1 trans y2 trans2' );
 
73