[93b078]: t / group.t Maximize Restore History

Download this file

group.t    45 lines (29 with data), 1.0 kB

 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
use PDL::HDF5;
use PDL::HDF5::Group;
print "1..5\n";
my $testNo = 1;
# New File Check:
my $filename = "newFile.hd5";
# get rid of filename if it already exists
unlink $filename if( -e $filename);
my $hdfobj;
ok($testNo++,$hdfobj = new PDL::HDF5("newFile.hd5"));
my $group = new PDL::HDF5::Group( 'name'=> '/dude', filename => "newFile.hd5",
fileID => $hdfobj->{fileID});
# Set attribute for group
ok($testNo++, $group->attrSet( 'attr1' => 'dudeman', 'attr2' => 'What??'));
# Try Setting attr for an existing attr
ok($testNo++,$group->attrSet( 'attr1' => 'dudeman23'));
# Add a attribute and then delete it
ok($testNo++, $group->attrSet( 'dummyAttr' => 'dummyman',
'dummyAttr2' => 'dummyman'));
ok($testNo++, $group->attrDel( 'dummyAttr', 'dummyAttr2' ));
unlink("newfile.hd5");
print "completed\n";
# Testing utility functions:
sub ok {
my $no = shift ;
my $result = shift ;
print "not " unless $result ;
print "ok $no\n" ;
}