本文整理汇总了PHP中Symfony\Component\Intl\Util\IntlTestHelper::require64Bit方法的典型用法代码示例。如果您正苦于以下问题:PHP IntlTestHelper::require64Bit方法的具体用法?PHP IntlTestHelper::require64Bit怎么用?PHP IntlTestHelper::require64Bit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Intl\Util\IntlTestHelper
的用法示例。
在下文中一共展示了IntlTestHelper::require64Bit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParseTypeInt64With64BitIntegerInPhp64Bit
/**
* If PHP is compiled in 64bit mode, the returned value for a 64bit integer are 32bit integer numbers.
*/
public function testParseTypeInt64With64BitIntegerInPhp64Bit()
{
IntlTestHelper::require64Bit($this);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64);
$this->assertInternalType('integer', $parsedValue);
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
// A 32 bit integer was being generated instead of a 64 bit integer
if (version_compare(PHP_VERSION, '5.3.14', '<') || version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) {
$this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
} else {
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
}
$parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64);
$this->assertInternalType('integer', $parsedValue);
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
// A 32 bit integer was being generated instead of a 64 bit integer
if (version_compare(PHP_VERSION, '5.3.14', '<') || version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) {
$this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
} else {
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
}
}
示例2: testParseTypeInt64With64BitIntegerInPhp64Bit
/**
* If PHP is compiled in 64bit mode, the returned value for a 64bit integer are 32bit integer numbers.
*/
public function testParseTypeInt64With64BitIntegerInPhp64Bit()
{
IntlTestHelper::require64Bit($this);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64);
$this->assertInternalType('integer', $parsedValue);
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
$parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64);
$this->assertInternalType('integer', $parsedValue);
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
}