#! /usr/local/bin/perl use strict; use warnings; use Test::More tests => 8; sub same_sign { my $x = shift; my $y = shift; return if $x > 0 and $y < 0 or $x < 0 and $y > 0; return 1; } ok(same_sign( 2, 4), '+ve +ve'); ok(same_sign(-2,-4), '-ve -ve'); ok(!same_sign( 2,-4), '+ve -ve'); ok(!same_sign(-2, 4), '-ve +ve'); ok(same_sign( 2, 0), '+ve 0'); ok(same_sign( 0, 4), '0 +ve'); ok(same_sign( -2, 0), '-ve 0'); ok(same_sign( 0, -4), '0 -ve');