File: vlenString.t

package info (click to toggle)
libpdl-io-hdf5-perl 1%3A0.75-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 336 kB
  • sloc: perl: 1,544; makefile: 9
file content (39 lines) | stat: -rwxr-xr-x 822 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Test case for reading variable-length string arrays.
#   These are converted to fixed-length PDL::Char types when read

use strict;
use warnings;
use PDL;
use PDL::Char;
use PDL::IO::HDF5;
use Test::More;

# New File Check:
my $filename = "varlen.hdf5";

ok(my $h5obj = new PDL::IO::HDF5(">".$filename));

my $dataset = $h5obj->dataset("Dataset");

my $pdl = $dataset->get();

my @dims = $pdl->dims;

is(join(", ", @dims), "93, 4");

is($pdl->atstr(2), "Now we are engaged in a great civil war,");

###### Now check variable-length string attribute array ###
($pdl) = $dataset->attrGet('Attr1');

@dims = $pdl->dims;

is(join(", ", @dims), "14, 4");

is($pdl->atstr(2), "Attr String 3");

###### Now check variable-length string attribute scalar ###
($pdl) = $dataset->attrGet('attr2');
is($pdl, "dude");

done_testing;