File: howbig.t

package info (click to toggle)
pdl 1%3A2.019-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,276 kB
  • sloc: perl: 47,799; fortran: 13,113; ansic: 9,365; sh: 41; makefile: 38; sed: 6
file content (24 lines) | stat: -rw-r--r-- 565 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
# Test datatype sizes in bytes are correct

use strict;
use warnings;

use Test::More;
use PDL::LiteF;
use PDL::Core ':Internal'; # For howbig()

my @types = (
	{ typefunc => *byte  , size => 1 },
	{ typefunc => *short , size => 2 },
	{ typefunc => *ushort, size => 2 },
	{ typefunc => *long  , size => 4 },
	{ typefunc => *float , size => 4 },
	{ typefunc => *double, size => 8 },
);

plan tests => 0+@types;

for my $type (@types) {
	my $pdl = $type->{typefunc}(42); # build a PDL with datatype $type->{type}
	is( howbig( $pdl->get_datatype ), $type->{size} );
}