File: iotypes.t

package info (click to toggle)
pdl 1%3A2.4.7%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,128 kB
  • ctags: 5,821
  • sloc: perl: 26,328; fortran: 13,113; ansic: 9,378; makefile: 71; sh: 50; sed: 6
file content (35 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use PDL::LiteF;
use PDL::Types ':All';

use PDL::IO::FlexRaw;
use PDL::Config;

use Test;
use strict;

# eventually this should test all our io routines with all
# supported types

# $SIG{__DIE__} = sub {print Carp::longmess(@_); die ;};
BEGIN { 
  my @ntypes = (PDL::Types::typesrtkeys());
  plan tests => scalar @ntypes;
}

our @types = map { print "making type $_\n";
		   new PDL::Type typefld($_,'numval') } typesrtkeys();

my $data = $PDL::Config{TEMPDIR} . "/tmprawdata";

for my $type (@types) {
  print "checking type $type...\n";
  my $pdl = sequence $type, 10;
  my $hdr = writeflex $data, $pdl;
  writeflexhdr($data,$hdr);
  my $npdl = eval {readflex $data};
  ok ($pdl->type == $npdl->type && 
     all $pdl == $npdl);
}

unlink $data, "${data}.hdr";