<commit_before><?php

namespace ROH\Bundle\StackManagerBundle\Tests\TwigExtension;

use PHPUnit_Framework_TestCase;
use ROH\Bundle\StackManagerBundle\TwigExtension\CidrTwigExtension;

class CidrTwigExtensionTest extends PHPUnit_Framework_TestCase
{
    public function testBasicUsage()
    {
        $ext = new CidrTwigExtension();
        $this->assertEquals(
            '10.0.0.0/16',
            $ext->cidr('10.0.0.0/16', 16)
        );
    }

    public function testContainerBlockSizeExceeded()
    {
        $this->setExpectedExceptionRegExp(
          'Exception', '/The size of the desired block exceeds the size of the container block.*/'
        );

        $ext = new CidrTwigExtension();
        $ext->cidr('10.0.0.0/24', 16);
    }

    public function testIncrementingPrefixSizes()
    {<commit_msg>Add tests to complete coverage of the CidrTwigExtension.<commit_after><?php

namespace ROH\Bundle\StackManagerBundle\Tests\TwigExtension;

use PHPUnit_Framework_TestCase;
use ROH\Bundle\StackManagerBundle\TwigExtension\CidrTwigExtension;

class CidrTwigExtensionTest extends PHPUnit_Framework_TestCase
{
    public function testFilterDefinition()
    {
        $expectedFilters = ['cidr'];

        $actualFilters = [];
        $ext = new CidrTwigExtension();
        foreach ($ext->getFilters() as $filter) {
            $actualFilters[] = $filter->getName();
        }

        sort($expectedFilters);
        sort($actualFilters);

        $this->assertEquals($actualFilters, $expectedFilters);
    }

    public function testExtensionName()
    {
        $ext = new CidrTwigExtension();
        $this->assertEquals('roh_cidr', $ext->getName());
    }

    public function testBasicUsage()
    {
        $ext = new CidrTwigExtension();
        $this->assertEquals(
            '10.0.0.0/16',
            $ext->cidr('10.0.0.0/16', 16)
        );
    }

    public function testContainerBlockSizeExceeded()
    {
        $this->setExpectedExceptionRegExp(
          'Exception', '/The size of the desired block exceeds the size of the container block.*/'
        );

        $ext = new CidrTwigExtension();
        $ext->cidr('10.0.0.0/24', 16);
    }

    public function testIncrementingPrefixSizes()
    {
{'fraction_non_alphanumeric': 0.11875843454790823, 'fraction_numerical': 0.02249212775528565, 'mean_word_length': 2.7315436241610738, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '7660945', 'n_tokens_mistral': 690, 'n_tokens_neox': 670, 'n_words': 128}