<commit_before><?php
namespace Haystack\Tests\Functional;

use Haystack\HArray;

class HArrayMapTest extends \PHPUnit_Framework_TestCase
{
    /** @var HArray */
    private $arrList;
    /** @var HArray */
    private $arrDict;

    protected function setUp()
    {
        $this->arrList = new HArray(["apple", "bobble", "cobble", "dobble"]);
        $this->arrDict = new HArray(["a" => "apple", "b" => "bobble", "c" => "cobble", "d" => "dobble"]);
    }

    public function testArrayMap()
    {
        $capitalizeList = function ($word) {
            return strtoupper($word);
        };

        $newArrList = $this->arrList->map($capitalizeList);
        $this->assertEquals("APPLE", $newArrList[0]);
    }

}<commit_msg>Add test for mapping over a dict array<commit_after><?php
namespace Haystack\Tests\Functional;

use Haystack\HArray;

class HArrayMapTest extends \PHPUnit_Framework_TestCase
{
    /** @var HArray */
    private $arrList;
    /** @var HArray */
    private $arrDict;

    protected function setUp()
    {
        $this->arrList = new HArray(["apple", "bobble", "cobble", "dobble"]);
        $this->arrDict = new HArray(["a" => "apple", "b" => "bobble", "c" => "cobble", "d" => "dobble"]);
    }

    public function testArrayMap()
    {
        $capitalizeList = function ($word) {
            return strtoupper($word);
        };

        $newArrList = $this->arrList->map($capitalizeList);
        $this->assertEquals("APPLE", $newArrList[0]);

        $newArrDict = $this->arrDict->map($capitalizeList);
        $this->assertEquals("APPLE", $newArrDict["a"]);
    }

}
{'fraction_non_alphanumeric': 0.17584480600750937, 'fraction_numerical': 0.0012515644555694619, 'mean_word_length': 2.948148148148148, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '3499627', 'n_tokens_mistral': 545, 'n_tokens_neox': 529, 'n_words': 107}