<commit_before><?php

namespace Concise\Console\ResultPrinter\Utilities;

class ProgressBarTest extends ProgressBarTestCase
{
    /**
     * @var ProgressBar
     */
    protected $progressBar;

    public function setUp()
    {
        parent::setUp();
        $this->progressBar = new ProgressBar();
    }

    public function testOneColorFillUpEntireBar()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'green' => 5,
            )
        );
        $this->assert($result, equals, $this->color(5, 'green'));
    }

    public function testTwoColors()
    {
        $result = $this->progressBar->render(
            6,
            array(
                'green' => 3,
                'red' => 3,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(3, 'green') . $this->color(3, 'red')
        );
    }

    public function testPartsMustBeProportionalToTheTotal()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'green' => 60,
                'red' => 40,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(3, 'green') . $this->color(2, 'red')
        );
    }

    public function testPartsAreNotAlwaysCleanlyDivisible()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'green' => 4,
                'red' => 7,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(1, 'green') . $this->color(4, 'red')
        );
    }

    public function testLessThanOneBarWillAlwaysShowOneBar()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => 1,
                'blue' => 19,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(1, 'yellow') . $this->color(4, 'blue')
        );
    }

    public function testZeroIsAllowed()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => 0,
                'blue' => 19,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(0, 'yellow') . $this->color(5, 'blue')
        );
    }

    public function testNegativeValuesAreAllowed()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => -5,
                'blue' => 19,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(0, 'yellow') . $this->color(5, 'blue')
        );
    }

    public function testTotalIsZero()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => 1,
                'blue' => -1,
            )
        );
        $this->assert(
            $result,
            equals,
            $this->color(0, 'yellow') . $this->color(0, 'blue')
        );
    }

    /**
     * @expectedException \InvalidArgumentException
     * @expectedExceptionMessage Expected integer, but got string for argument 1
     */
    public function testSizeMustBeAnInteger()
    {
        $this->progressBar->render('abc', array());
    }
}
<commit_msg>ProgressBarTest<commit_after><?php

namespace Concise\Console\ResultPrinter\Utilities;

class ProgressBarTest extends ProgressBarTestCase
{
    /**
     * @var ProgressBar
     */
    protected $progressBar;

    public function setUp()
    {
        parent::setUp();
        $this->progressBar = new ProgressBar();
    }

    public function testOneColorFillUpEntireBar()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'green' => 5,
            )
        );
        $this->aassert($result)->equals($this->color(5, 'green'));
    }

    public function testTwoColors()
    {
        $result = $this->progressBar->render(
            6,
            array(
                'green' => 3,
                'red' => 3,
            )
        );
        $this->aassert($result)
            ->equals($this->color(3, 'green') . $this->color(3, 'red'));
    }

    public function testPartsMustBeProportionalToTheTotal()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'green' => 60,
                'red' => 40,
            )
        );
        $this->aassert($result)
            ->equals($this->color(3, 'green') . $this->color(2, 'red'));
    }

    public function testPartsAreNotAlwaysCleanlyDivisible()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'green' => 4,
                'red' => 7,
            )
        );
        $this->aassert($result)
            ->equals($this->color(1, 'green') . $this->color(4, 'red'));
    }

    public function testLessThanOneBarWillAlwaysShowOneBar()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => 1,
                'blue' => 19,
            )
        );
        $this->aassert($result)
            ->equals($this->color(1, 'yellow') . $this->color(4, 'blue'));
    }

    public function testZeroIsAllowed()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => 0,
                'blue' => 19,
            )
        );
        $this->aassert($result)
            ->equals($this->color(0, 'yellow') . $this->color(5, 'blue'));
    }

    public function testNegativeValuesAreAllowed()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => -5,
                'blue' => 19,
            )
        );
        $this->aassert($result)
            ->equals($this->color(0, 'yellow') . $this->color(5, 'blue'));
    }

    public function testTotalIsZero()
    {
        $result = $this->progressBar->render(
            5,
            array(
                'yellow' => 1,
                'blue' => -1,
            )
        );
        $this->aassert($result)
            ->equals($this->color(0, 'yellow') . $this->color(0, 'blue'));
    }

    /**
     * @expectedException \InvalidArgumentException
     * @expectedExceptionMessage Expected integer, but got string for argument 1
     */
    public function testSizeMustBeAnInteger()
    {
        $this->progressBar->render('abc', array());
    }
}

{'fraction_non_alphanumeric': 0.14686693976634804, 'fraction_numerical': 0.013351539978758913, 'mean_word_length': 1.3260409315455186, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 125, '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': '5527381', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1859, 'n_words': 330}