Moontoast\Math\BigNumberTest::testConvertToBase10 PHP Метод

testConvertToBase10() публичный Метод

public testConvertToBase10 ( )
    public function testConvertToBase10()
    {
        $fromBase = array(2, 8, 10, 16, 36);
        $convertValues = array(10, 27, 39, 03, 0x5f, '10', '27', '39', '5F', '5f', '3XYZ', '3xyz', '5f$@');
        foreach ($fromBase as $from) {
            foreach ($convertValues as $val) {
                // Test that our baseConvert matches PHP's base_convert
                $phpRes = base_convert($val, $from, 10);
                $bnRes = BigNumber::convertToBase10($val, $from);
                $this->assertEquals($phpRes, $bnRes, "from base is {$from}, to base is 10, value is {$val}, convertToBase10 result is {$bnRes}");
            }
        }
    }