<commit_before><?php

namespace mcordingley\LinearAlgebra;

class MatrixTest extends \PHPUnit_Framework_TestCase
{
    private function buildMatrix()
    {
        return new Matrix([
            [1, 2, 3, 4],
            [5, 6, 7, 8],
            [9, 10, 11, 12],
        ]);
    }

    public function testBadConstruction()
    {
        try {
            new Matrix([
                [1, 2, 3, 4],
                [5, 6, 7],
                [9, 10],
            ]);
        } catch (MatrixException $exception) {
            return;
        }

        $this->fail('MatrixException not raised.');
    }

    public function testSize()
    {
        $matrix = $this->buildMatrix();

        $this->assertEquals(3, $matrix->rows);
        $this->assertEquals(4, $matrix->columns);
    }

    public function testIdentity()
    {<commit_msg>Increase test coverage.<commit_after><?php

namespace mcordingley\LinearAlgebra;

class MatrixTest extends \PHPUnit_Framework_TestCase
{
    private function buildMatrix()
    {
        return new Matrix([
            [1, 2, 3, 4],
            [5, 6, 7, 8],
            [9, 10, 11, 12],
        ]);
    }

    public function testProperties()
    {
        $matrix = $this->buildMatrix();

        static::assertEquals(4, $matrix->columns);
        static::assertEquals(3, $matrix->rows);
        static::assertNull($matrix->fubar);
    }

    public function testBadConstruction()
    {
        $this->setExpectedException(MatrixException::class);

        new Matrix([
            [1, 2, 3, 4],
            [5, 6, 7],
            [9, 10],
        ]);
    }

    public function testEmptyRows()
    {
        $this->setExpectedException(MatrixException::class);

        new Matrix([]);
    }

    public function testEmptyColumns()
    {
        $this->setExpectedException(MatrixException::class);

        new Matrix([
            [],
            [],
        ]);
    }

    public function testSize()
    {
        $matrix = $this->buildMatrix();

        $this->assertEquals(3, $matrix->rows);
        $this->assertEquals(4, $matrix->columns);
    }

    public function testIdentity()
    {
{'fraction_non_alphanumeric': 0.13764044943820225, 'fraction_numerical': 0.026217228464419477, 'mean_word_length': 1.804461942257218, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '3669877', 'n_tokens_mistral': 655, 'n_tokens_neox': 599, 'n_words': 135}