cvs: pear /Math_Basex package.xml /Math_Basex/tests integer-test.php
| From: | Dave Mertens | Date: | Thu, 12 Dec 2002 19:37:12 +0000 |
| Subject: | cvs: pear /Math_Basex package.xml /Math_Basex/tests integer-test.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7856@lists.php.net to get a copy of this message | ||
zyprexia Thu Dec 12 14:37:12 2002 EDT
Added files:
/pear/Math_Basex/tests integer-test.php
Modified files:
/pear/Math_Basex package.xml
Log:
Added integer test case.
Changed package.xml for second release.
Index: pear/Math_Basex/package.xml
diff -u pear/Math_Basex/package.xml:1.3 pear/Math_Basex/package.xml:1.4
--- pear/Math_Basex/package.xml:1.3 Wed Dec 11 13:50:11 2002
+++ pear/Math_Basex/package.xml Thu Dec 12 14:37:11 2002
@@ -5,7 +5,7 @@
<package version="1.0">
<name>Math_Basex</name>
<description>Base X conversion class</description>
- <summary>Simple class for converting base set of numbers with a customize character base
set.</summary>
+ <summary>Simple class for converting base set of numbers with a customizable character base
set.</summary>
<maintainers>
<maintainer>
<user>zyprexia</user>
@@ -14,10 +14,10 @@
</maintainer>
</maintainers>
<release>
- <version>0.1</version>
+ <version>0.2</version>
<license>PHP</license>
<state>stable</state>
- <date>2002-12-10</date>
+ <date>2002-12-12</date>
<notes>
The maximum number that can be used is different per platform.
If your long (int4) integer is too short and your platform doesn't
@@ -28,9 +28,10 @@
<dir name="/" baseinstalldir="Math">
<file role="php">Basex.php</file>
</dir>
- <dir name="tests" baseinstalldir="????">
+ <dir name="tests" baseinstalldir="Math">
<file role="test">Basex.php</file>
<file role="test">convert_base.php</file>
+ <file role="test">integer-test.php</file>
</dir>
</filelist>
</release>
Index: pear/Math_Basex/tests/integer-test.php
+++ pear/Math_Basex/tests/integer-test.php
<?php
/*
Run this test to validate whether your system support int8 (64-bit) integers.
If int4 is the maximum of your system, maybe bcmath is an option for you!
*/
include_once ( "Math/Basex.php" );
// PHASE 1: Simple toBase and toDecimal calls
$base = new Basex("ABCDEF");
echo "Using character set: 'ABCDEF'\n";
echo validateResult("toBase(123456)", $base->toBase(123456), "CDFBDCA");
echo validateResult("toDecimal(\"BADA\")",
$base->toDecimal("BADA"), "234");
echo "\n\n";
//PHASE 2: Testing int2
$base->setBase("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
echo "Changing to character base 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n";
echo validateResult("int2 (Max 65536) toBase(65432)", $base->toBase(65432),
"DSUQ");
echo validateResult("int2 (Max 65536) tobase(67000) OVERFLOW!", $base->toBase(67000),
"DVCY");
//PHASE 3: Testing int4
echo validateResult("int4 (Max 42944967297) toBase(64872767)", $base->toBase(64872767),
"FLYZQL");
echo validateResult("int4 (Max 42944967297) tobase(43987654321) OVERFLOW!",
$base->toBase(43987654321), "FMKGDIOB");
//PHASE $: Testing int8
echo validateResult("int8 (Max 18446744073709551616) toBase(18446744073709551610)",
$base->toBase(1844674407370955), "NBTNBSZVFVD");
echo validateResult("int8 (Max 18446744073709551616) tobase(18446744073709551618)
OVERFLOW!", $base->toBase(18446744073709551618), "HLHXCZQBGYKMWB");
function validateResult($description, $result, $compareString)
{
if ((string)$result == (string)$compareString)
$ret = "PASSED";
else
$ret = "$result FAILED!!";
return sprintf("%'.-72.72s %s\n", $description, $ret);
}
?>