<commit_before><?php

declare(strict_types=1);

/*
 * This file is part of the SkeletonDancer package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Rollerworks\Tools\SkeletonDancer\Tests;

use Rollerworks\Tools\SkeletonDancer\StringUtil;

final class StringUtilTest extends \PHPUnit_Framework_TestCase
{
    /** @test */
    public function it_gets_the_Nth_dirname()
    {
        self::assertEquals('Generators', StringUtil::getNthDirname('src/Generators/', 1));
        self::assertEquals('Generators', StringUtil::getNthDirname('src/Generators', 1));
        self::assertEquals('Generators', StringUtil::getNthDirname('Generators', 0));

        self::assertEquals('src', StringUtil::getNthDirname('src/Generators/', 0));
        self::assertEquals('src', StringUtil::getNthDirname('src\\Generators/', 0));
        self::assertEquals('NotExistent', StringUtil::getNthDirname('Generators/', 1, 'NotExistent'));

        // Reverse look-up
        self::assertEquals('Deeper', StringUtil::getNthDirname('src/Generators/Foo/Deeper', -1));
        self::assertEquals('src', StringUtil::getNthDirname('src/', -1));
        self::assertEquals('', StringUtil::getNthDirname('src/', -2));<commit_msg>Add extra test for StringUtilTest<commit_after><?php

declare(strict_types=1);

/*
 * This file is part of the SkeletonDancer package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Rollerworks\Tools\SkeletonDancer\Tests;

use Rollerworks\Tools\SkeletonDancer\StringUtil;

final class StringUtilTest extends \PHPUnit_Framework_TestCase
{
    /** @test */
    public function it_gets_the_Nth_dirname()
    {
        self::assertEquals('Generators', StringUtil::getNthDirname('src/Generators/', 1));
        self::assertEquals('Generators', StringUtil::getNthDirname('src/Generators', 1));
        self::assertEquals('Generators', StringUtil::getNthDirname('Generators', 0));

        self::assertEquals('src', StringUtil::getNthDirname('src/Generators/', 0));
        self::assertEquals('src', StringUtil::getNthDirname('src\\Generators/', 0));
        self::assertEquals('NotExistent', StringUtil::getNthDirname('Generators/', 1, 'NotExistent'));

        // Reverse look-up
        self::assertEquals('Deeper', StringUtil::getNthDirname('src/Generators/Foo/Deeper', -1));
        self::assertEquals('Foo', StringUtil::getNthDirname('src/Generators/Foo/Deeper', -2));
        self::assertEquals('src', StringUtil::getNthDirname('src/', -1));
        self::assertEquals('', StringUtil::getNthDirname('src/', -2));
{'fraction_non_alphanumeric': 0.15793330890436058, 'fraction_numerical': 0.007695126419934042, 'mean_word_length': 4.7594936708860756, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '482857', 'n_tokens_mistral': 854, 'n_tokens_neox': 816, 'n_words': 158}