<commit_before><?php

namespace Gentry\Test;

use Reflector;
use ReflectionMethod;
use Gentry\Group;
use zpt\anno\Annotations;
use Exception;
use ErrorException;
use Generator;
use Closure;

/**
 * Abstract base class for a feature test. Normally only used internally.
 */
abstract class Feature
{
    protected $description;
    protected $target;
    protected $name;
    protected $class;
    protected $messages = [];
    protected $tested;

    /**
     * Constructor.
     *
     * @param array $description Description of the feature, as regexed from
     *  its doccomment. Index 0 is the full description, 2 is the parameter
     *  number of the target to test.
     * @param int $target The target to test against, expressed as the argument
     *  number.
     * @param string $name The name of the feature.
     * @param string $class String version of the target's class. Needed for
     *  abstract testing.
     */
    public function __construct(array $description, $name)
    {
        $this->description = $description[0];
        $this->target = $description[2];
        $this->name = $name;
        \Gentry\out(str_replace(
            '{'.$this->target.'}',
            "<darkBlue>".$this->testedFeature()."<blue>",
            "<blue>{$this->description}"
        ));
    }

    /**
     * Assert that for given arguments the expected result(s) are found,
     * optionally piped through a callable.
     *
     * @param array &$args The arguments to use.
     * @param array $expected Hash of expected result, output and/or exception.
     * @param callable $pipe Optional callable to pipe actual result through.
     * @return bool True if the assertion holds, else false.
     */
    public function assert(array &$args, $expected, callable $pipe = null)
    {
        $property = !($this instanceof Method);
        $actual = $this->actual($args) + ['result' => null];
        if ($expected['result'] instanceof Closure) {
            $actual['result'] = call_user_func($expected['result'], $actual['result']);
            $expected['result'] = true;
        }
        if (isset($pipe)) {<commit_msg>index is now 1<commit_after><?php

namespace Gentry\Test;

use Reflector;
use ReflectionMethod;
use Gentry\Group;
use zpt\anno\Annotations;
use Exception;
use ErrorException;
use Generator;
use Closure;

/**
 * Abstract base class for a feature test. Normally only used internally.
 */
abstract class Feature
{
    protected $description;
    protected $target;
    protected $name;
    protected $class;
    protected $messages = [];
    protected $tested;

    /**
     * Constructor.
     *
     * @param array $description Description of the feature, as regexed from
     *  its doccomment. Index 0 is the full description, 2 is the parameter
     *  number of the target to test.
     * @param int $target The target to test against, expressed as the argument
     *  number.
     * @param string $name The name of the feature.
     * @param string $class String version of the target's class. Needed for
     *  abstract testing.
     */
    public function __construct(array $description, $name)
    {
        $this->description = $description[0];
        $this->target = $description[1];
        $this->name = $name;
        \Gentry\out(str_replace(
            '{'.$this->target.'}',
            "<darkBlue>".$this->testedFeature()."<blue>",
            "<blue>{$this->description}"
        ));
    }

    /**
     * Assert that for given arguments the expected result(s) are found,
     * optionally piped through a callable.
     *
     * @param array &$args The arguments to use.
     * @param array $expected Hash of expected result, output and/or exception.
     * @param callable $pipe Optional callable to pipe actual result through.
     * @return bool True if the assertion holds, else false.
     */
    public function assert(array &$args, $expected, callable $pipe = null)
    {
        $property = !($this instanceof Method);
        $actual = $this->actual($args) + ['result' => null];
        if ($expected['result'] instanceof Closure) {
            $actual['result'] = call_user_func($expected['result'], $actual['result']);
            $expected['result'] = true;
        }
        if (isset($pipe)) {
{'fraction_non_alphanumeric': 0.11985898942420682, 'fraction_numerical': 0.0021151586368977674, 'mean_word_length': 2.656357388316151, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, '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': '6471056', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1161, 'n_words': 405}