<commit_before><?php

namespace Rainbow\Tests\Calculation;

use Rainbow\Calculation\Channel\Luma;
use Rainbow\Rgb;
use Rainbow\Unit\Percent;

class LumaTest extends \PHPUnit_Framework_TestCase
{
    public function testLuminanceInBlackShouldReturnMinValue()
    {
        $color = new Rgb(0, 0, 0);
        $luminance = new Luma($color);

        $this->assertEquals(new Percent(0), $luminance->result());
    }

    public function testLuminanceInWhiteShouldReturnMaxValue()
    {
        $color = new Rgb(255, 255, 255);
        $luminance = new Luma($color);

        $this->assertEquals(new Percent(100), $luminance->result());
    }

    /**
     * @dataProvider getLuminanceDataProvider
     */
    public function testLuminanceShouldReturnValidPercentage($expected, $value)
    {
        $color = new Rgb($value["red"], $value["green"], $value["blue"]);
        $luminance = new Luma($color);

        $this->assertEquals(new Percent($expected), $luminance->result());
    }

    public function getLuminanceDataProvider()
    {
        return array(
            array(13, array("red" => 100, "green" => 100, "blue" => 100)),<commit_msg>Improve naming<commit_after><?php

namespace Rainbow\Tests\Calculation\Channel;

use Rainbow\Calculation\Channel\Luma;
use Rainbow\Rgb;
use Rainbow\Unit\Percent;

class LumaTest extends \PHPUnit_Framework_TestCase
{
    public function testBlackShouldReturnMinValue()
    {
        $color = new Rgb(0, 0, 0);
        $operation = new Luma($color);

        $this->assertEquals(new Percent(0), $operation->result());
    }

    public function testWhiteShouldReturnMaxValue()
    {
        $color = new Rgb(255, 255, 255);
        $operation = new Luma($color);

        $this->assertEquals(new Percent(100), $operation->result());
    }

    /**
     * @dataProvider getColorDataProvider
     */
    public function testColorShouldReturnValidPercentage($expected, $value)
    {
        $color = new Rgb($value["red"], $value["green"], $value["blue"]);
        $operation = new Luma($color);

        $this->assertEquals(new Percent($expected), $operation->result());
    }

    public function getColorDataProvider()
    {
        return array(
            array(13, array("red" => 100, "green" => 100, "blue" => 100)),
{'fraction_non_alphanumeric': 0.14361467079098542, 'fraction_numerical': 0.023862129916040652, 'mean_word_length': 3.24765478424015, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '7655113', 'n_tokens_mistral': 739, 'n_tokens_neox': 664, 'n_words': 140}