PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Perl | 53 lines | 29 code | 13 blank | 11 comment | 0 complexity | e34b914a2b9effe10fd6065191dd38b2 MD5 | raw file
 1#!/usr/bin/perl
 2use strict;
 3use warnings;
 4use Test::More tests => 16;
 5BEGIN { use_ok('template_typedef_cplx2') }
 6require_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
19my $d = eval { make_Identity_double() };
20ok(ref($d), 'is an object');
21like(ref($d), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
22
23my $e = eval { make_Multiplies_double_double_double_double($d, $d) };
24ok(ref($e), 'is an object');
25like(ref($e), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
26
27#
28# complex case
29#
30
31my $c = eval { make_Identity_complex() };
32ok(ref($c), 'is an object');
33like(ref($c), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
34
35my $f = eval { make_Multiplies_complex_complex_complex_complex($c, $c) };
36ok(ref($f), 'is an object');
37like(ref($f), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
38
39#
40# Mix case
41#
42
43my $g = eval { make_Multiplies_double_double_complex_complex($d, $c) };
44ok(ref($g), 'is an object');
45like(ref($g), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
46
47my $h = eval { make_Multiplies_complex_complex_double_double($c, $d) };
48ok(ref($h), 'is an object');
49like(ref($h), qr/ArithUnaryFunction/, "is an ArithUnaryFunction");
50
51can_ok($g, 'get_value');
52ok(eval { $g->get_value() }, 'get_value');
53