<commit_before><?php

// Ensure backward compatibility
// @see http://stackoverflow.com/questions/42811164/class-phpunit-framework-testcase-not-found#answer-42828632
if (!class_exists('\PHPUnit\Framework\TestCase')) {
    class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}

/**
 * Class StringCalcTest for tests with PHPUnit.
 */
class StringCalcTest extends \PHPUnit\Framework\TestCase
{

    /**
     * @var \ChrisKonnertz\StringCalc\StringCalc|null
     */
    private $stringCalc = null;

    /**
     * Creates and returns an instance of the main class
     *
     * @return \ChrisKonnertz\StringCalc\StringCalc
     */
    protected function getInstance()
    {
        return new ChrisKonnertz\StringCalc\StringCalc();
    }

    public function testCalculations()
    {
        $this->stringCalc = $this->getInstance();

        // Numbers
        $numbers = [
            ['0', 0],
            ['1', 1],
            ['1337', 1337],
            ['1.0', 1.0],
            ['1.23456789', 1.23456789],
        ];

        // Operators
        $operators = [
            ['1+0', 1],
            ['1+1', 2],
            ['-1+1', 0],

            ['1-0', 1],
            ['1-1', 0],
            ['1-2', -1],

            ['1*0', 0],
            ['1*1', 1],
            ['2*2', 4],
            ['-1*1', -1],
            ['-1*-1', 1],

            ['1/1', 1],
            ['2/1', 2],
            ['1/2', 0.5],
            ['-1/2', -0.5],
        ];

        // Brackets
        $brackets = [
            ['()', 0],
            ['(2)', 2],
            ['((3))', 3],
            ['(1+2)', 3],
            ['(-2)', -2],
            ['((1+2)*(3+4))', 21],
        ];

        $this->doCalculations($numbers + $operators + $brackets);

        // Constants
        $constants = [
            ['e', M_E],
            ['euler', M_EULER],
            ['lnPi', M_LNPI],
            ['lnTen', M_LN10],
            ['lnTwo', M_LN2],
            ['logTenE', M_LOG10E],
            ['logTwoE', M_LOG2E],
            ['onePi', M_1_PI],
            ['pi', M_PI],
            ['piFour', M_PI_4],
            ['piTwo', M_PI_2],
            ['sqrtOneTwo', M_SQRT1_2],
            ['sqrtPi', M_SQRTPI],
            ['sqrtThree', M_SQRT3],<commit_msg>Added failing test<commit_after><?php

// Ensure backward compatibility
// @see http://stackoverflow.com/questions/42811164/class-phpunit-framework-testcase-not-found#answer-42828632
if (!class_exists('\PHPUnit\Framework\TestCase')) {
    class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}

/**
 * Class StringCalcTest for tests with PHPUnit.
 */
class StringCalcTest extends \PHPUnit\Framework\TestCase
{

    /**
     * @var \ChrisKonnertz\StringCalc\StringCalc|null
     */
    private $stringCalc = null;

    /**
     * Creates and returns an instance of the main class
     *
     * @return \ChrisKonnertz\StringCalc\StringCalc
     */
    protected function getInstance()
    {
        return new ChrisKonnertz\StringCalc\StringCalc();
    }

    public function testCalculations()
    {
        $this->stringCalc = $this->getInstance();

        // Numbers
        $numbers = [
            ['0', 0],
            ['1', 1],
            ['1337', 1337],
            ['1.0', 1.0],
            ['1.23456789', 1.23456789],
        ];

        // Operators
        $operators = [
            ['1+0', 1],
            ['1+1', 2],
            ['-1+1', 0],

            ['1-0', 1],
            ['1-1', 0],
            ['1-2', -1],

            ['1*0', 0],
            ['1*1', 1],
            ['2*2', 4],
            ['-1*1', -1],
            ['-1*-1', 1],

            ['1/1', 1],
            ['2/1', 2],
            ['1/2', 0.5],
            ['-1/2', -0.5],
        ];

        // Brackets
        $brackets = [
            ['()', 0],
            ['(2)', 2],
            ['((3))', 3],
            ['(1+2)', 3],
            ['(-2)', -2],
            ['((1+2)*(3+4))', 21],
        ];

        $this->doCalculations($numbers + $operators + $brackets);

        // Constants
        $constants = [
            ['e', M_E],
            ['euler', M_EULER],
            ['lnPi', M_LNPI],
            ['lnTen', M_LN10],
            ['lnTwo', M_LN2],
            ['logTenE', M_LOG10E],
            ['logTwoE', M_LOG2E],
            ['onePi', M_1_PI],
            ['pi', M_PI],
            ['piFour', M_PI_4],
            ['piTwos', M_PI_2],
            ['sqrtOneTwo', M_SQRT1_2],
            ['sqrtPi', M_SQRTPI],
            ['sqrtThree', M_SQRT3],
{'fraction_non_alphanumeric': 0.19336283185840708, 'fraction_numerical': 0.05530973451327434, 'mean_word_length': 1.4451054624121147, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1043612', 'n_tokens_mistral': 1660, 'n_tokens_neox': 1515, 'n_words': 275}