<commit_before><?php

namespace Mimic\Test;

use PHPUnit_Framework_TestCase;
use Mimic\Functional as F;

/**
 * Unit Test for hash_array Mimic library function.
 *
 * @since 0.1.0
 */
class HashArrayFuncTest extends PHPUnit_Framework_TestCase {
	public function dataProvider() {
		$callback = function() { return true; };
		$callbackName = str_replace('\\', '\\\\', get_class($callback));
		$callbackRef = spl_object_hash($callback);
		$invokeTrue = 'Mimic\\\\\\\\Test\\\\\\\\Stub\\\\\\\\InvokeTrue';
		$invokeFalse = 'Mimic\\\\\\\\Test\\\\\\\\Stub\\\\\\\\InvokeFalse';
		return array(
			array(
				array(),
				'/\[\]/'
			),
			array(
				array(1, 2, 3),
				'/\[1,2,3\]/'
			),
			array(
				array(new Stub\InvokeTrue, new Stub\InvokeFalse, 1, 2),
				'/\["'.$invokeTrue.':[0-9a-zA-Z]+","'.$invokeFalse.':[0-9a-zA-Z]+",1,2\]/'
			),
			array(
				array(1, 2, new Stub\InvokeTrue, new Stub\InvokeFalse),
				'/\[1,2,"'.$invokeTrue.':[0-9a-zA-Z]+","'.$invokeFalse.':[0-9a-zA-Z]+"\]/'
			),
			array(
				array($callback),
				'/\["'.$callbackName.':'.$callbackRef.'"\]/'
			),<commit_msg>Make sure dollar sign is escaped in regex.<commit_after><?php

namespace Mimic\Test;

use PHPUnit_Framework_TestCase;
use Mimic\Functional as F;

/**
 * Unit Test for hash_array Mimic library function.
 *
 * @since 0.1.0
 */
class HashArrayFuncTest extends PHPUnit_Framework_TestCase {
	public function dataProvider() {
		$callback = function() { return true; };
		$callbackName = str_replace(array('\\', '$'), array('\\\\', '\$'), get_class($callback));
		$callbackRef = spl_object_hash($callback);
		$invokeTrue = 'Mimic\\\\\\\\Test\\\\\\\\Stub\\\\\\\\InvokeTrue';
		$invokeFalse = 'Mimic\\\\\\\\Test\\\\\\\\Stub\\\\\\\\InvokeFalse';
		return array(
			array(
				array(),
				'/\[\]/'
			),
			array(
				array(1, 2, 3),
				'/\[1,2,3\]/'
			),
			array(
				array(new Stub\InvokeTrue, new Stub\InvokeFalse, 1, 2),
				'/\["'.$invokeTrue.':[0-9a-zA-Z]+","'.$invokeFalse.':[0-9a-zA-Z]+",1,2\]/'
			),
			array(
				array(1, 2, new Stub\InvokeTrue, new Stub\InvokeFalse),
				'/\[1,2,"'.$invokeTrue.':[0-9a-zA-Z]+","'.$invokeFalse.':[0-9a-zA-Z]+"\]/'
			),
			array(
				array($callback),
				'/\["'.$callbackName.':'.$callbackRef.'"\]/'
			),
{'fraction_non_alphanumeric': 0.25604297224709044, 'fraction_numerical': 0.022381378692927483, 'mean_word_length': 2.8402061855670104, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4010980', 'n_tokens_mistral': 990, 'n_tokens_neox': 827, 'n_words': 140}