<commit_before><?php

namespace PhpCollection\Tests;

use PhpCollection\Map;

class MapTest extends \PHPUnit_Framework_TestCase
{
    /** @var Map */
    private $map;

    public function testExists()
    {
        $this->assertFalse($this->map->exists(function($k) { return $k === 0; }));

        $this->map->set('foo', 'bar');
        $this->assertTrue($this->map->exists(function($k, $v) { return $k === 'foo' && $v === 'bar'; }));
    }

    public function testSet()
    {
        $this->assertTrue($this->map->get('asdf')->isEmpty());
        $this->map->set('asdf', 'foo');
        $this->assertEquals('foo', $this->map->get('asdf')->get());

        $this->assertEquals('bar', $this->map->get('foo')->get());
        $this->map->set('foo', 'asdf');
        $this->assertEquals('asdf', $this->map->get('foo')->get());
    }

    public function testSetSetAll()
    {
        $this->map->setAll(array('foo' => 'asdf', 'bar' => array('foo')));
        $this->assertEquals(array('foo' => 'asdf', 'bar' => array('foo'), 'baz' => 'boo'), iterator_to_array($this->map));
    }
<commit_msg>Added all() test<commit_after><?php

namespace PhpCollection\Tests;

use PhpCollection\Map;

class MapTest extends \PHPUnit_Framework_TestCase
{
    /** @var Map */
    private $map;

    public function testExists()
    {
        $this->assertFalse($this->map->exists(function($k) { return $k === 0; }));

        $this->map->set('foo', 'bar');
        $this->assertTrue($this->map->exists(function($k, $v) { return $k === 'foo' && $v === 'bar'; }));
    }

    public function testSet()
    {
        $this->assertTrue($this->map->get('asdf')->isEmpty());
        $this->map->set('asdf', 'foo');
        $this->assertEquals('foo', $this->map->get('asdf')->get());

        $this->assertEquals('bar', $this->map->get('foo')->get());
        $this->map->set('foo', 'asdf');
        $this->assertEquals('asdf', $this->map->get('foo')->get());
    }

    public function testSetSetAll()
    {
        $this->map->setAll(array('foo' => 'asdf', 'bar' => array('foo')));
        $this->assertEquals(array('foo' => 'asdf', 'bar' => array('foo'), 'baz' => 'boo'), iterator_to_array($this->map));
    }
    
    public function testAll()
    {
        $this->map->setAll(array('foo' => 'asdf', 'bar' => array('foo')));
        $this->assertEquals(array('foo' => 'asdf', 'bar' => array('foo'), 'baz' => 'boo'), $this->map->all());
    }

{'fraction_non_alphanumeric': 0.25495867768595043, 'fraction_numerical': 0.0008264462809917355, 'mean_word_length': 3.2177700348432055, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 87, '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': '2349765', 'n_tokens_mistral': 807, 'n_tokens_neox': 801, 'n_words': 130}