This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert Net::Ping's tests to use Test::More from Test.
[perl5.git] / dist / Net-Ping / t / 510_ping_udp.t
CommitLineData
c94ff782
JH
1# Test to perform udp protocol testing.
2
2f794ae1
NC
3use strict;
4
f8abf63d
SP
5sub isWindowsVista {
6 return unless $^O eq 'MSWin32' or $^O eq "cygwin";
7 return unless eval { require Win32 };
8 return unless defined &Win32::GetOSName;
9 return Win32::GetOSName() eq "WinVista";
10}
11
c94ff782
JH
12BEGIN {
13 unless (eval "require Socket") {
14 print "1..0 \# Skip: no Socket\n";
15 exit;
16 }
f8abf63d 17 unless (getservbyname('echo', 'udp')) {
7ac0cca8 18 print "1..0 \# Skip: no udp echo port\n";
f8abf63d
SP
19 exit;
20 }
21
22 if(isWindowsVista()) {
23 print "1..0 \# Skip: udp ping blocked by Vista's default settings\n";
c94ff782
JH
24 exit;
25 }
26}
27
2f794ae1
NC
28use Test::More tests => 2;
29BEGIN {use_ok('Net::Ping')};
c94ff782
JH
30
31my $p = new Net::Ping "udp";
2f794ae1 32is($p->ping("127.0.0.1"), 1);