PageRenderTime 27ms CodeModel.GetById 17ms app.highlight 8ms RepoModel.GetById 1ms 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
 1#!/usr/bin/perl
 2use strict;
 3use warnings;
 4use Test::More tests => 14;
 5BEGIN { use_ok('ignore_parameter') }
 6require_ok('ignore_parameter');
 7
 8# adapted from ../java/ignore_parameter_runme.java
 9
10# Runtime test checking the %typemap(ignore) macro
11
12# Compilation will ensure the number of arguments and type are correct.
13# Then check the return value is the same as the value given to the ignored parameter.
14is(ignore_parameter::jaguar(200, 0.0), "hello", "jaguar()");
15is(ignore_parameter::lotus("fast", 0.0), 101, "lotus()");
16is(ignore_parameter::tvr("fast", 200), 8.8, "tvr()");
17is(ignore_parameter::ferrari(), 101, "ferrari()");
18
19my $sc = new ignore_parameter::SportsCars();
20is($sc->daimler(200, 0.0), "hello", "daimler()");
21is($sc->astonmartin("fast", 0.0), 101, "astonmartin()");
22is($sc->bugatti("fast", 200), 8.8, "bugatti()");
23is($sc->lamborghini(), 101, "lamborghini()");
24
25# Check constructors are also generated correctly
26my $mc = eval { new ignore_parameter::MiniCooper(200, 0.0) };
27isa_ok($mc, 'ignore_parameter::MiniCooper');
28my $mm = eval { new ignore_parameter::MorrisMinor("slow", 0.0) };
29isa_ok($mm, 'ignore_parameter::MorrisMinor');
30my $fa = eval { new ignore_parameter::FordAnglia("slow", 200) };
31isa_ok($fa, 'ignore_parameter::FordAnglia');
32my $aa = eval { new ignore_parameter::AustinAllegro() };
33isa_ok($aa, 'ignore_parameter::AustinAllegro');