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

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

    public function testConvertFromBase10()
    {
        $toBase = array(2, 8, 10, 16, 36);
        $convertValues = array(10, 27, 39, 03, 0x5f, '10', '27', '39');
        foreach ($toBase as $to) {
            foreach ($convertValues as $val) {
                // Test that our baseConvert matches PHP's base_convert
                $phpRes = base_convert($val, 10, $to);
                $bnRes = BigNumber::convertFromBase10($val, $to);
                $this->assertEquals($phpRes, $bnRes, "from base is 10, to base is {$to}, value is {$val}, convertFromBase10 result is {$bnRes}");
            }
        }
    }