aboutsummaryrefslogtreecommitdiffstats
path: root/tests/network/inet_ntop_pton_test.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-01-10 00:26:48 +0100
committerIgor Wiedler <igor@wiedler.ch>2011-01-10 00:37:47 +0100
commitb5c8349f4a3399750b13463db8ad54f1aadfe178 (patch)
treefd20263038d3d49d5ed06d45a7ee4d2a6be2c468 /tests/network/inet_ntop_pton_test.php
parent95c683056b85399200e2caaa9aa65edc6843c16f (diff)
parentd7299f5071d461e6bf77df8c96b19bcd1bf027db (diff)
downloadforums-b5c8349f4a3399750b13463db8ad54f1aadfe178.tar
forums-b5c8349f4a3399750b13463db8ad54f1aadfe178.tar.gz
forums-b5c8349f4a3399750b13463db8ad54f1aadfe178.tar.bz2
forums-b5c8349f4a3399750b13463db8ad54f1aadfe178.tar.xz
forums-b5c8349f4a3399750b13463db8ad54f1aadfe178.zip
Merge branch 'develop-olympus' into develop
This merge commit includes ascraeus-specific renames and adjustments.
Diffstat (limited to 'tests/network/inet_ntop_pton_test.php')
-rw-r--r--tests/network/inet_ntop_pton_test.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/network/inet_ntop_pton_test.php b/tests/network/inet_ntop_pton_test.php
new file mode 100644
index 0000000000..7d4f44aaca
--- /dev/null
+++ b/tests/network/inet_ntop_pton_test.php
@@ -0,0 +1,54 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
+
+class phpbb_network_inet_ntop_pton_test extends phpbb_test_case
+{
+ public function data_provider()
+ {
+ return array(
+ array('127.0.0.1', '7f000001'),
+ array('192.232.131.223', 'c0e883df'),
+ array('13.1.68.3', '0d014403'),
+ array('129.144.52.38', '81903426'),
+
+ array('2001:280:0:10::5', '20010280000000100000000000000005'),
+ array('fe80::200:4cff:fefe:172f', 'fe8000000000000002004cfffefe172f'),
+
+ array('::', '00000000000000000000000000000000'),
+ array('::1', '00000000000000000000000000000001'),
+ array('1::', '00010000000000000000000000000000'),
+
+ array('1:1:0:0:1::', '00010001000000000001000000000000'),
+
+ array('0:2:3:4:5:6:7:8', '00000002000300040005000600070008'),
+ array('1:2:0:4:5:6:7:8', '00010002000000040005000600070008'),
+ array('1:2:3:4:5:6:7:0', '00010002000300040005000600070000'),
+
+ array('2001:0:0:1::1', '20010000000000010000000000000001'),
+ );
+ }
+
+ /**
+ * @dataProvider data_provider
+ */
+ public function test_inet_ntop($address, $hex)
+ {
+ $this->assertEquals($address, phpbb_inet_ntop(pack('H*', $hex)));
+ }
+
+ /**
+ * @dataProvider data_provider
+ */
+ public function test_inet_pton($address, $hex)
+ {
+ $this->assertEquals($hex, bin2hex(phpbb_inet_pton($address)));
+ }
+}