PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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. # adapted from ../python/template_typedef_cplx3_runme.py
  8. { # kids, don't try this at home (glob hijinks)
  9. my $cvar = *template_typedef_cplx3::;
  10. map { ${*::}{$_} = ${$cvar}{$_} } keys %{$cvar};
  11. }
  12. my $s = Sin->new();
  13. is($s->get_base_value(), 0);
  14. is($s->get_value(), 1);
  15. is($s->get_arith_value(), 2);
  16. is(my_func_r($s), 0);
  17. isa_ok(make_Multiplies_double_double_double_double($s,$s),
  18. "template_typedef_cplx3::ArithUnaryFunction_double_double");
  19. my $z = CSin->new();
  20. is($z->get_base_value(), 0);
  21. is($z->get_value(), 1);
  22. is($z->get_arith_value(), 2);
  23. is(my_func_c($z), 1);
  24. isa_ok(make_Multiplies_complex_complex_complex_complex($z,$z),
  25. "template_typedef_cplx3::ArithUnaryFunction_complex_complex");
  26. my $d = eval { make_Identity_double() };
  27. isa_ok($d, "template_typedef_cplx3::ArithUnaryFunction_double_double");
  28. is(my_func_r($d), 0);
  29. my $c = eval { make_Identity_complex() };
  30. isa_ok($d, "template_typedef_cplx3::ArithUnaryFunction_double_double");
  31. is(my_func_c($c), 1);