From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- .../Component/Intl/Tests/Util/IcuVersionTest.php | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php') diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php new file mode 100644 index 00000000..d1a7e8c1 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Intl\Tests\Util; + +use Symfony\Component\Intl\Util\IcuVersion; + +/** + * @author Bernhard Schussek + */ +class IcuVersionTest extends \PHPUnit_Framework_TestCase +{ + public function normalizeProvider() + { + return array( + array(null, '1', '10'), + array(null, '1.2', '12'), + array(null, '1.2.3', '12.3'), + array(null, '1.2.3.4', '12.3.4'), + array(1, '1', '10'), + array(1, '1.2', '12'), + array(1, '1.2.3', '12'), + array(1, '1.2.3.4', '12'), + array(2, '1', '10'), + array(2, '1.2', '12'), + array(2, '1.2.3', '12.3'), + array(2, '1.2.3.4', '12.3'), + array(3, '1', '10'), + array(3, '1.2', '12'), + array(3, '1.2.3', '12.3'), + array(3, '1.2.3.4', '12.3.4'), + ); + } + + /** + * @dataProvider normalizeProvider + */ + public function testNormalize($precision, $version, $result) + { + $this->assertSame($result, IcuVersion::normalize($version, $precision)); + } + + public function compareProvider() + { + return array( + array(null, '1', '==', '1', true), + array(null, '1.0', '==', '1.1', false), + array(null, '1.0.0', '==', '1.0.1', false), + array(null, '1.0.0.0', '==', '1.0.0.1', false), + array(null, '1.0.0.0.0', '==', '1.0.0.0.1', false), + + array(null, '1', '==', '10', true), + array(null, '1.0', '==', '11', false), + array(null, '1.0.0', '==', '10.1', false), + array(null, '1.0.0.0', '==', '10.0.1', false), + array(null, '1.0.0.0.0', '==', '10.0.0.1', false), + + array(1, '1', '==', '1', true), + array(1, '1.0', '==', '1.1', false), + array(1, '1.0.0', '==', '1.0.1', true), + array(1, '1.0.0.0', '==', '1.0.0.1', true), + array(1, '1.0.0.0.0', '==', '1.0.0.0.1', true), + + array(1, '1', '==', '10', true), + array(1, '1.0', '==', '11', false), + array(1, '1.0.0', '==', '10.1', true), + array(1, '1.0.0.0', '==', '10.0.1', true), + array(1, '1.0.0.0.0', '==', '10.0.0.1', true), + + array(2, '1', '==', '1', true), + array(2, '1.0', '==', '1.1', false), + array(2, '1.0.0', '==', '1.0.1', false), + array(2, '1.0.0.0', '==', '1.0.0.1', true), + array(2, '1.0.0.0.0', '==', '1.0.0.0.1', true), + + array(2, '1', '==', '10', true), + array(2, '1.0', '==', '11', false), + array(2, '1.0.0', '==', '10.1', false), + array(2, '1.0.0.0', '==', '10.0.1', true), + array(2, '1.0.0.0.0', '==', '10.0.0.1', true), + + array(3, '1', '==', '1', true), + array(3, '1.0', '==', '1.1', false), + array(3, '1.0.0', '==', '1.0.1', false), + array(3, '1.0.0.0', '==', '1.0.0.1', false), + array(3, '1.0.0.0.0', '==', '1.0.0.0.1', true), + + array(3, '1', '==', '10', true), + array(3, '1.0', '==', '11', false), + array(3, '1.0.0', '==', '10.1', false), + array(3, '1.0.0.0', '==', '10.0.1', false), + array(3, '1.0.0.0.0', '==', '10.0.0.1', true), + ); + } + + /** + * @dataProvider compareProvider + */ + public function testCompare($precision, $version1, $operator, $version2, $result) + { + $this->assertSame($result, IcuVersion::compare($version1, $version2, $operator, $precision)); + } +} -- cgit v1.2.3