<commit_before><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 * @package   Zend_Console
 */

namespace ZendTest\Console;

use Zend\Console\Color\Xterm256;

/**
 * @category   Zend
 * @package    Zend_Console
 * @subpackage UnitTests
 * @group      Zend_Console
 */
class Xterm256Test extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {

    }
    public function testWrongHexCodeInputs()
    {
        $whexs = array(
            'FFFFFF0',
            'ABCDEFG',
            '01048212',
            'ééààööüü',
            'FF00GG',
            null,
        );
        foreach ($whexs as $hex) {
            $color = Xterm256::calculate($hex);
            $r = new \ReflectionClass($color);
            $code = $r->getStaticPropertyValue('color');
            $this->assertNull($code);
        }
    }
    public function testApproximateHexCodeInputs() {
        $ahexs = array(
            '000100'    => 16,
            'FF33A0'    => 199,
        );
        foreach ($ahexs as $hex => $gcode) {
            $color = Xterm256::calculate($hex);
            $r = new \ReflectionClass($color);
            $gcode = sprintf('%%s;5;%s', $gcode);
            $this->assertEquals($gcode, $r->getStaticPropertyValue('color'));
        }
    }
    public function testExactHexCodeInputs()
    {
        $ehexs = array(
            '000000'    => 16,
            '00005F'    => 17,
            '000087'    => 18,<commit_msg>cs fix<commit_after><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 * @package   Zend_Console
 */

namespace ZendTest\Console;

use Zend\Console\Color\Xterm256;

/**
 * @category   Zend
 * @package    Zend_Console
 * @subpackage UnitTests
 * @group      Zend_Console
 */
class Xterm256Test extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {

    }
    public function testWrongHexCodeInputs()
    {
        $whexs = array(
            'FFFFFF0',
            'ABCDEFG',
            '01048212',
            'ééààööüü',
            'FF00GG',
            null,
        );
        foreach ($whexs as $hex) {
            $color = Xterm256::calculate($hex);
            $r = new \ReflectionClass($color);
            $code = $r->getStaticPropertyValue('color');
            $this->assertNull($code);
        }
    }
    public function testApproximateHexCodeInputs()
    {
        $ahexs = array(
            '000100'    => 16,
            'FF33A0'    => 199,
        );
        foreach ($ahexs as $hex => $gcode) {
            $color = Xterm256::calculate($hex);
            $r = new \ReflectionClass($color);
            $gcode = sprintf('%%s;5;%s', $gcode);
            $this->assertEquals($gcode, $r->getStaticPropertyValue('color'));
        }
    }
    public function testExactHexCodeInputs()
    {
        $ehexs = array(
            '000000'    => 16,
            '00005F'    => 17,
            '000087'    => 18,
{'fraction_non_alphanumeric': 0.1380123857269242, 'fraction_numerical': 0.04128575641403716, 'mean_word_length': 1.9393414211438476, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5286652', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1055, 'n_words': 208}