diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
commit | 222b01f5169f1c7e69762e0e8904c24f78f71882 (patch) | |
tree | 8e932e12546bb991357ec48eb1638d1770be7a35 /t/inc/IP.t | |
parent | 00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff) |
update to MediaWiki 1.16.0
Diffstat (limited to 't/inc/IP.t')
-rw-r--r-- | t/inc/IP.t | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/t/inc/IP.t b/t/inc/IP.t deleted file mode 100644 index eb717252..00000000 --- a/t/inc/IP.t +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env php -<?php - -require 't/Test.php'; - -plan( 1120 ); - -require_ok( 'includes/IP.php' ); - -# some of this test data was taken from Data::Validate::IP - -# -# isValid() -# - -foreach ( range( 0, 255 ) as $i ) { - $a = sprintf( "%03d", $i ); - $b = sprintf( "%02d", $i ); - $c = sprintf( "%01d", $i ); - foreach ( array_unique( array( $a, $b, $c ) ) as $f ) { - $ip = "$f.$f.$f.$f"; - ok( IP::isValid( $ip ), "$ip is a valid IPv4 address" ); - } -} - -# A bit excessive perhaps? meh.. -foreach ( range( 256, 999 ) as $i ) { - $a = sprintf( "%03d", $i ); - $b = sprintf( "%02d", $i ); - $c = sprintf( "%01d", $i ); - foreach ( array_unique( array( $a, $b, $c ) ) as $f ) { - $ip = "$f.$f.$f.$f"; - ok( ! IP::isValid( $ip ), "$ip is not a valid IPv4 address" ); - } -} - -$invalid = array( - 'www.xn--var-xla.net', - '216.17.184.G', - '216.17.184.1.', - '216.17.184', - '216.17.184.', - '256.17.184.1' -); - -foreach ( $invalid as $i ) { - ok( ! IP::isValid( $i ), "$i is an invalid IPv4 address" ); -} - -# -# isPublic() -# - -$private = array( '10.0.0.1', '172.16.0.1', '192.168.0.1' ); - -foreach ( $private as $p ) { - ok( ! IP::isPublic( $p ), "$p is not a public IP address" ); -} - -/* vim: set filetype=php: */ |