File: hdrs.t

package info (click to toggle)
pdl 2.005-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,200 kB
  • ctags: 3,301
  • sloc: perl: 14,876; ansic: 7,223; fortran: 3,417; makefile: 54; sh: 16
file content (45 lines) | stat: -rw-r--r-- 751 bytes parent folder | download
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
36
37
38
39
40
41
42
43
44
45
use PDL::LiteF;

$|=1;

#  PDL::Core::set_debugging(1);
kill INT,$$  if $ENV{UNDER_DEBUGGER}; # Useful for debugging.

sub ok {
	my $no = shift ;
	my $result = shift ;
	print "not " unless $result ;
	print "ok $no\n" ;
}

sub hdrcmp {
  my ($ah,$bh) = map {$_->gethdr} @_;
  return $ah == $bh;
}

print "1..6\n";

$a = zeroes(20);
$a->hdrcpy(1);
$a->dump;
$a->sethdr( {Field1=>'arg1',
	     Field2=>'arg2'});
print "a: ",$a->gethdr(),"\n";
ok(1,$a->hdrcpy);

$b = $a+1;
print "b: ",$b->gethdr(),"\n";
ok(2, defined($b->gethdr));
ok(3,hdrcmp($a,$b));

$c = $a->slice('0:5');
print "c: ",$c->gethdr(),"\n";
ok(4,hdrcmp($a,$c));

$d = $a->copy;
print "d: ",$d->gethdr(),"\n";
ok(5,hdrcmp($a,$d));

$a->hdrcpy(0);
ok(6,!defined($a->slice('3')->gethdr));