]> granicus.if.org Git - php/commitdiff
fix test, add 64bit version
authorAntony Dovgal <tony2001@php.net>
Sat, 2 Feb 2008 23:44:39 +0000 (23:44 +0000)
committerAntony Dovgal <tony2001@php.net>
Sat, 2 Feb 2008 23:44:39 +0000 (23:44 +0000)
ext/standard/tests/math/bindec_basic.phpt
ext/standard/tests/math/bindec_basic_64bit.phpt [new file with mode: 0644]

index fe9ab099f7b31352cba3fbb2c1eacd74ebd8f130..e50dc8d4893f8ea1ca410a2346053a872ee460d0 100644 (file)
@@ -1,5 +1,9 @@
 --TEST--
 Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
 --FILE--
 <?php
 $values = array(111000111,
@@ -46,4 +50,4 @@ int(6)
 int(0)
 int(1)
 int(0)
-int(0)
\ No newline at end of file
+int(0)
diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt
new file mode 100644 (file)
index 0000000..0069837
--- /dev/null
@@ -0,0 +1,53 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+$values = array(111000111,
+                               011100000,
+                               1111111111111111111111111111111,
+                               10000000000000000000000000000000,
+                               100002001,
+                               '111000111',
+                               '011100000',
+                               '1111111111111111111111111111111',
+                               '10000000000000000000000000000000',
+                               '100002001',
+                               'abcdefg',
+                               311015,
+                               31101.3,
+                               31.1013e5,
+                               0x111ABC,
+                               011237,                         
+                               true,
+                               false,
+                               null);  
+
+for ($i = 0; $i < count($values); $i++) {
+       $res = bindec($values[$i]);
+       var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+int(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)