PageRenderTime 15ms CodeModel.GetById 2ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/perl5/template_typedef_cplx3_runme.pl

#
Perl | 41 lines | 29 code | 10 blank | 2 comment | 0 complexity | ccf3a3fbedcd5076017388c79f263f8a MD5 | raw file
 1#!/usr/bin/perl
 2use strict;
 3use warnings;
 4use Test::More tests => 16;
 5BEGIN { use_ok('template_typedef_cplx3') }
 6require_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
15my $s = Sin->new();
16is($s->get_base_value(), 0);
17is($s->get_value(), 1);
18is($s->get_arith_value(), 2);
19is(my_func_r($s), 0);
20isa_ok(make_Multiplies_double_double_double_double($s,$s),
21  "template_typedef_cplx3::ArithUnaryFunction_double_double");
22
23my $z = CSin->new();
24is($z->get_base_value(), 0);
25is($z->get_value(), 1);
26is($z->get_arith_value(), 2);
27is(my_func_c($z), 1);
28isa_ok(make_Multiplies_complex_complex_complex_complex($z,$z),
29  "template_typedef_cplx3::ArithUnaryFunction_complex_complex");
30
31my $d = eval { make_Identity_double() };
32isa_ok($d, "template_typedef_cplx3::ArithUnaryFunction_double_double");
33is(my_func_r($d), 0);
34
35my $c = eval { make_Identity_complex() };
36isa_ok($d, "template_typedef_cplx3::ArithUnaryFunction_double_double");
37is(my_func_c($c), 1);
38  
39
40
41