<commit_before><?php
/**
 * Dead simple, high performance, drop-in bridge to Golang RPC with zero dependencies
 *
 * @author Wolfy-J
 */

namespace Spiral\Tests\Prototypes;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;

abstract class ProcessTest extends TestCase
{
    const FORCE_BUILD = false;
    const GO_APP      = "socket4bytes";
    const GO_ARGS     = "";

    /** @var Process */
    protected $process;

    public function setUp()
    {
        $dir = dirname(dirname(__DIR__));
        $file = static::GO_APP;

        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            if (self::FORCE_BUILD || !file_exists($dir . "/{$file}.exe")) {
                $build = new Process("go build {$file}.go", $dir);
                $build->mustRun();
            }

            //enable in firewall
            $this->process = new Process("{$file}.exe " . static::GO_ARGS, $dir);
        } else {
            if (self::FORCE_BUILD || !file_exists($dir . "/{$file}")) {
                $build = new Process("go build {$file}", $dir);
                $build->mustRun();
            }

            $this->process = new Process("go run {$file} " . static::GO_ARGS, $dir);
        }

        $this->process->start();
    }

    public function tearDown()
    {
        if ($this->process->isRunning()) {
            $this->process->signal(0);
        }
    }

    public function testConnected()
    {
        $this->assertTrue($this->process->isStarted());
        $this->assertTrue($this->process->isRunning());
    }

    public function testDieAndRestart()
    {
        $this->assertTrue($this->process->isRunning());
        $this->process->signal(0);
        $this->assertFalse($this->process->isRunning());
<commit_msg>test changes<commit_after><?php
/**
 * Dead simple, high performance, drop-in bridge to Golang RPC with zero dependencies
 *
 * @author Wolfy-J
 */

namespace Spiral\Tests\Prototypes;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;

abstract class ProcessTest extends TestCase
{
    const FORCE_BUILD = false;
    const GO_APP      = "socket4bytes";
    const GO_ARGS     = "";

    /** @var Process */
    protected $process;

    public function setUp()
    {
        $dir = dirname(dirname(__DIR__));
        $file = static::GO_APP;

        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            if (self::FORCE_BUILD || !file_exists($dir . "/{$file}.exe")) {
                $build = new Process("go build {$file}.go", $dir);
                $build->mustRun();
            }

            //enable in firewall
            $this->process = new Process("{$file}.exe " . static::GO_ARGS, $dir);
        } else {
            if (self::FORCE_BUILD || !file_exists($dir . "/{$file}")) {
                $build = new Process("go build {$file}", $dir);
                $build->mustRun();
            }

            $this->process = new Process("{$file} " . static::GO_ARGS, $dir);
        }

        $this->process->start();
    }

    public function tearDown()
    {
        if ($this->process->isRunning()) {
            $this->process->signal(0);
        }
    }

    public function testConnected()
    {
        $this->assertTrue($this->process->isStarted());
        $this->assertTrue($this->process->isRunning());
    }

    public function testDieAndRestart()
    {
        $this->assertTrue($this->process->isRunning());
        $this->process->signal(0);
        $this->assertFalse($this->process->isRunning());

{'fraction_non_alphanumeric': 0.16590649942987457, 'fraction_numerical': 0.0028506271379703536, 'mean_word_length': 2.1842105263157894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '1443622', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1021, 'n_words': 211}