import source from 1.3.40
[external/swig.git] / Examples / test-suite / perl5 / template_typedef_cplx3_runme.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Test::More tests => 16;
5 BEGIN { use_ok('template_typedef_cplx3') }
6 require_ok('template_typedef_cplx3');
7
8 # adapted from ../python/template_typedef_cplx3_runme.py
9
10 {       # kids, don't try this at home (glob hijinks)
11         my $cvar = *template_typedef_cplx3::;
12         map { ${*::}{$_} = ${$cvar}{$_} } keys %{$cvar};
13 }
14
15 my $s = Sin->new();
16 is($s->get_base_value(), 0);
17 is($s->get_value(), 1);
18 is($s->get_arith_value(), 2);
19 is(my_func_r($s), 0);
20 isa_ok(make_Multiplies_double_double_double_double($s,$s),
21   "template_typedef_cplx3::ArithUnaryFunction_double_double");
22
23 my $z = CSin->new();
24 is($z->get_base_value(), 0);
25 is($z->get_value(), 1);
26 is($z->get_arith_value(), 2);
27 is(my_func_c($z), 1);
28 isa_ok(make_Multiplies_complex_complex_complex_complex($z,$z),
29   "template_typedef_cplx3::ArithUnaryFunction_complex_complex");
30
31 my $d = eval { make_Identity_double() };
32 isa_ok($d, "template_typedef_cplx3::ArithUnaryFunction_double_double");
33 is(my_func_r($d), 0);
34
35 my $c = eval { make_Identity_complex() };
36 isa_ok($d, "template_typedef_cplx3::ArithUnaryFunction_double_double");
37 is(my_func_c($c), 1);
38   
39
40
41