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'); 34