summaryrefslogtreecommitdiff
path: root/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl
blob: e0a3003d2331cfcf548497ac4741b135030f8304 (plain)
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
46
47
48
49
50
51
52
53
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 16;
BEGIN { use_ok('template_typedef_cplx2') }
require_ok('template_typedef_cplx2');

# adapted from ../python/template_typedef_cplx2_runme.py

{	# kids, don't try this at home (glob hijinks)
	my $cvar = *template_typedef_cplx2::;
	map { ${*::}{$_} = ${$cvar}{$_} } keys %{$cvar};
}

#
# double case
#

my $d = eval { make_Identity_double() };
ok(ref($d), 'is an object');
like(ref($d), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");

my $e = eval { make_Multiplies_double_double_double_double($d, $d) };
ok(ref($e), 'is an object');
like(ref($e), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");

#
# complex case
#

my $c = eval { make_Identity_complex() };
ok(ref($c), 'is an object');
like(ref($c), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");

my $f = eval { make_Multiplies_complex_complex_complex_complex($c, $c) };
ok(ref($f), 'is an object');
like(ref($f), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");

#
# Mix case
#

my $g = eval { make_Multiplies_double_double_complex_complex($d, $c) };
ok(ref($g), 'is an object');
like(ref($g), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");

my $h = eval { make_Multiplies_complex_complex_double_double($c, $d) };
ok(ref($h), 'is an object');
like(ref($h), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");

can_ok($g, 'get_value');
ok(eval { $g->get_value() }, 'get_value');