Upstream version 1.3.40
[profile/ivi/swig.git] / Examples / test-suite / perl5 / template_typedef_cplx2_runme.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Test::More tests => 16;
5 BEGIN { use_ok('template_typedef_cplx2') }
6 require_ok('template_typedef_cplx2');
7
8 # adapted from ../python/template_typedef_cplx2_runme.py
9
10 {       # kids, don't try this at home (glob hijinks)
11         my $cvar = *template_typedef_cplx2::;
12         map { ${*::}{$_} = ${$cvar}{$_} } keys %{$cvar};
13 }
14
15 #
16 # double case
17 #
18
19 my $d = eval { make_Identity_double() };
20 ok(ref($d), 'is an object');
21 like(ref($d), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
22
23 my $e = eval { make_Multiplies_double_double_double_double($d, $d) };
24 ok(ref($e), 'is an object');
25 like(ref($e), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
26
27 #
28 # complex case
29 #
30
31 my $c = eval { make_Identity_complex() };
32 ok(ref($c), 'is an object');
33 like(ref($c), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
34
35 my $f = eval { make_Multiplies_complex_complex_complex_complex($c, $c) };
36 ok(ref($f), 'is an object');
37 like(ref($f), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
38
39 #
40 # Mix case
41 #
42
43 my $g = eval { make_Multiplies_double_double_complex_complex($d, $c) };
44 ok(ref($g), 'is an object');
45 like(ref($g), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
46
47 my $h = eval { make_Multiplies_complex_complex_double_double($c, $d) };
48 ok(ref($h), 'is an object');
49 like(ref($h), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
50
51 can_ok($g, 'get_value');
52 ok(eval { $g->get_value() }, 'get_value');
53