<commit_before><?php

namespace Zazalt\Strink\Tests;

use Zazalt\Strink\Strink;

class StrinkTest extends \Zazalt\Strink\Tests\ZazaltTest
{
    protected $that;

    public function __construct()
    {
        parent::loader(Strink::class, '');
    }

    public function testCompressSpaces(): void
    {
        $stringsToTest = [
            ' test  test test "  test   "' => ' test test test " test "',
            "Loreim I  psum dor  å  m" => "Loreim I psum dor å m",
        ];

        foreach($stringsToTest as $key => $value) {
            $this->assertEquals($value, \Zazalt\Strink\Strink::turn($key)->compressSpaces());
        }
    }

    public function testCompressSlashes(): void
    {
        $stringsToTest = [
            'lorem//ipsum/' => 'lorem/ipsum/',
            'lorem//IPSUM/' => 'lorem/IPSUM/',
            'lorem\\ipsum/' => 'lorem\\ipsum/',
            'test//utf¿8//strings\/' => 'test/utf¿8/strings\/',
            'http://localhost//test' => 'http://localhost/test',
            'http://///localhost//test' => 'http://localhost/test',
            'https://localhost//test' => 'https://localhost/test',
            'https://///localhost//test' => 'https://localhost/test',
            '////%var%//mytest/test///testing' => '/%var%/mytest/test/testing'
        ];

        foreach($stringsToTest as $key => $value) {
            $this->assertEquals($value, \Zazalt\Strink\Strink::turn($key)->compressSlashes());
        }
    }

    public function testCompressDoubleQuotesProvider(): void
    {
        return [
            '""Please test this string""' => '"Please test this string"',
            '"""Please "test\' this string""' => '"Please "test\' this string"',
            '""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
            '"""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
            '""Please test \"this\" string""' => '"Please test \"this\" string"',
            '"""Please test this string""' => '"Please test this string"',
            '""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
            '"""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
        ];
    }

    public function testCompressDoubleQuotes()
    {
        foreach($this->testCompressDoubleQuotesProvider() as $key => $value) {
            $this->assertEquals($value, \Zazalt\Strink\Strink::turn($key)->compressDoubleQuotes());
        }
    }

    public function testCompressSimpleQuotesProvider()
    {
        return [
            "''Please test this string''" => "'Please test this string'",
            "'''Please 'test\" this string''" => "'Please 'test\" this string'",
            "''Pleașe țest thîs string''" => "'Pleașe țest thîs string'",<commit_msg>The cake is a lie.<commit_after><?php

namespace Zazalt\Strink\Tests;

use Zazalt\Strink\Strink;

class StrinkTest extends \Zazalt\Strink\Tests\ZazaltTest
{
    protected $that;

    public function __construct()
    {
        parent::loader(Strink::class, '');
    }

    public function testCompressSpaces(): void
    {
        $stringsToTest = [
            ' test  test test "  test   "' => ' test test test " test "',
            "Loreim I  psum dor  å  m" => "Loreim I psum dor å m",
        ];

        foreach($stringsToTest as $key => $value) {
            $this->assertEquals($value, \Zazalt\Strink\Strink::turn($key)->compressSpaces());
        }
    }

    public function testCompressSlashes(): void
    {
        $stringsToTest = [
            'lorem//ipsum/' => 'lorem/ipsum/',
            'lorem//IPSUM/' => 'lorem/IPSUM/',
            'lorem\\ipsum/' => 'lorem\\ipsum/',
            'test//utf¿8//strings\/' => 'test/utf¿8/strings\/',
            'http://localhost//test' => 'http://localhost/test',
            'http://///localhost//test' => 'http://localhost/test',
            'https://localhost//test' => 'https://localhost/test',
            'https://///localhost//test' => 'https://localhost/test',
            '////%var%//mytest/test///testing' => '/%var%/mytest/test/testing'
        ];

        foreach($stringsToTest as $key => $value) {
            $this->assertEquals($value, \Zazalt\Strink\Strink::turn($key)->compressSlashes());
        }
    }

    public function testCompressDoubleQuotesProvider(): array
    {
        return [
            '""Please test this string""' => '"Please test this string"',
            '"""Please "test\' this string""' => '"Please "test\' this string"',
            '""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
            '"""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
            '""Please test \"this\" string""' => '"Please test \"this\" string"',
            '"""Please test this string""' => '"Please test this string"',
            '""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
            '"""Pleașe țest thîs string""' => '"Pleașe țest thîs string"',
        ];
    }

    public function testCompressDoubleQuotes()
    {
        foreach($this->testCompressDoubleQuotesProvider() as $key => $value) {
            $this->assertEquals($value, \Zazalt\Strink\Strink::turn($key)->compressDoubleQuotes());
        }
    }

    public function testCompressSimpleQuotesProvider()
    {
        return [
            "''Please test this string''" => "'Please test this string'",
            "'''Please 'test\" this string''" => "'Please 'test\" this string'",
            "''Pleașe țest thîs string''" => "'Pleașe țest thîs string'",
{'fraction_non_alphanumeric': 0.18070751276440555, 'fraction_numerical': 0.0007293946024799417, 'mean_word_length': 2.226470588235294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, 'https://': 8, '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': '3473878', 'n_tokens_mistral': 1753, 'n_tokens_neox': 1752, 'n_words': 365}