1# Test conversions. This is not yet good enough: we need
2# nasty test cases,
3
4# 1.9901 - converted to new type semantics + extra test
5
6use Test::More tests => 7;
7
8use strict;
9use warnings;
10
11use PDL::LiteF;
12use PDL::Types;
13use PDL::Constants qw(PI);
14use strict;
15use warnings;
16
17my $pa = pdl 42.4;
18note "A is $pa";
19
20is($pa->get_datatype,$PDL_D, "A is double");
21
22my $pb = byte $pa;
23note "B (byte $pa) is $pb";
24
25is($pb->get_datatype,$PDL_B, "B is byte");
26is($pb->at(),42, 'byte value is 42');
27
28my $pc = $pb * 3;
29is($pc->get_datatype, $PDL_B, "C also byte");
30note "C ($pb * 3) is $pc";
31
32my $pd = $pb * 600.0;
33is($pd->get_datatype, $PDL_F, "D promoted to float");
34note "D ($pb * 600) is $pd";
35
36my $pi = 4*atan2(1,1);
37
38my $pe = $pb * $pi;
39is($pe->get_datatype, $PDL_D, "E promoted to double (needed to represent result)");
40note "E ($pb * PI) is $pe";
41
42my $pf = $pb * "-2.2";
43is($pf->get_datatype, $PDL_D, "F check string handling");
44note "F ($pb * string(-2.2)) is $pf";
45