<commit_before><?php
use Vision\Validator;

class MaxStringLengthTest extends \PHPUnit_Framework_TestCase
{
    static $validatorOne;

    protected $singleBytes = array('$', '$$');
    
    protected $multiBytes = array('¢', '€', '¢¢', '€€');
    
    public static function setUpBeforeClass()
    {
        self::$validatorOne = new Validator\MaxStringLength(1);
    }
    
    public function testGetMax()
    {       
        $this->assertSame(1, self::$validatorOne->getMax());
    }
    
    public function testCastToInteger()
    {
        $validator = new Validator\MaxStringLength('1');
        
        $this->assertSame(1, $validator->getMax());
    }
    
    public function testSingleByteSuccess()
    {
        $this->assertTrue(self::$validatorOne->isValid($this->singleBytes[0]));
    }
    
    public function testSingleByteFailure()
    {
        $this->assertFalse(self::$validatorOne->isValid($this->singleBytes[1]));
    }
    
    public function testMultiByteSuccess()
    {
        $this->assertTrue(self::$validatorOne->isValid($this->multiBytes[0]));
        $this->assertTrue(self::$validatorOne->isValid($this->multiBytes[1]));
    }
    
    public function testMultiByteFailure()
    {
        $this->assertFalse(self::$validatorOne->isValid($this->multiBytes[2]));
        $this->assertFalse(self::$validatorOne->isValid($this->multiBytes[3]));
    }   
}<commit_msg>Add: test for four-byte chars<commit_after><?php
use Vision\Validator;

class MaxStringLengthTest extends \PHPUnit_Framework_TestCase
{
    static $validatorOne;

    protected $singleBytes = array('$', '$$');
    
    protected $multiBytes = array('¢', '€', "\xF0\xA4\xAD\xA2", '¢¢', '€€', "\xF0\xA4\xAD\xA2\xF0\xA4\xAD\xA2");
    
    public static function setUpBeforeClass()
    {
        self::$validatorOne = new Validator\MaxStringLength(1);
    }
    
    public function testGetMax()
    {       
        $this->assertSame(1, self::$validatorOne->getMax());
    }
    
    public function testCastToInteger()
    {
        $validator = new Validator\MaxStringLength('1');
        
        $this->assertSame(1, $validator->getMax());
    }
    
    public function testSingleByteSuccess()
    {
        $this->assertTrue(self::$validatorOne->isValid($this->singleBytes[0]));
    }
    
    public function testSingleByteFailure()
    {
        $this->assertFalse(self::$validatorOne->isValid($this->singleBytes[1]));
    }
    
    public function testMultiByteSuccess()
    {
        $this->assertTrue(self::$validatorOne->isValid($this->multiBytes[0]));
        $this->assertTrue(self::$validatorOne->isValid($this->multiBytes[1]));
        $this->assertTrue(self::$validatorOne->isValid($this->multiBytes[2]));
    }
    
    public function testMultiByteFailure()
    {
        $this->assertFalse(self::$validatorOne->isValid($this->multiBytes[3]));
        $this->assertFalse(self::$validatorOne->isValid($this->multiBytes[4]));
        $this->assertFalse(self::$validatorOne->isValid($this->multiBytes[5]));
    }   
}
{'fraction_non_alphanumeric': 0.16683151994724696, 'fraction_numerical': 0.01022090339597758, 'mean_word_length': 3.2022160664819945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7136510', 'n_tokens_mistral': 886, 'n_tokens_neox': 946, 'n_words': 120}