PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Perl | 33 lines | 22 code | 5 blank | 6 comment | 0 complexity | 157944f144d4a63c222a417644e2c95c 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 => 14;
  5. BEGIN { use_ok('ignore_parameter') }
  6. require_ok('ignore_parameter');
  7. # adapted from ../java/ignore_parameter_runme.java
  8. # Runtime test checking the %typemap(ignore) macro
  9. # Compilation will ensure the number of arguments and type are correct.
  10. # Then check the return value is the same as the value given to the ignored parameter.
  11. is(ignore_parameter::jaguar(200, 0.0), "hello", "jaguar()");
  12. is(ignore_parameter::lotus("fast", 0.0), 101, "lotus()");
  13. is(ignore_parameter::tvr("fast", 200), 8.8, "tvr()");
  14. is(ignore_parameter::ferrari(), 101, "ferrari()");
  15. my $sc = new ignore_parameter::SportsCars();
  16. is($sc->daimler(200, 0.0), "hello", "daimler()");
  17. is($sc->astonmartin("fast", 0.0), 101, "astonmartin()");
  18. is($sc->bugatti("fast", 200), 8.8, "bugatti()");
  19. is($sc->lamborghini(), 101, "lamborghini()");
  20. # Check constructors are also generated correctly
  21. my $mc = eval { new ignore_parameter::MiniCooper(200, 0.0) };
  22. isa_ok($mc, 'ignore_parameter::MiniCooper');
  23. my $mm = eval { new ignore_parameter::MorrisMinor("slow", 0.0) };
  24. isa_ok($mm, 'ignore_parameter::MorrisMinor');
  25. my $fa = eval { new ignore_parameter::FordAnglia("slow", 200) };
  26. isa_ok($fa, 'ignore_parameter::FordAnglia');
  27. my $aa = eval { new ignore_parameter::AustinAllegro() };
  28. isa_ok($aa, 'ignore_parameter::AustinAllegro');