<commit_before>import { dimensions, MatrixError } from '../source/matrix';
import assert from 'assert';


describe('matrix.dimensions', () => {
    it('should return the dimensions of an empty matrix', () => {
        var a = [];
        var expected = { 'rows': 0, 'columns': 0 };
        var actual = dimensions(a);
        assert.deepEqual(expected, actual);
    });

    it('should return the dimensions of a valid matrix', () => {
        var a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
        var expected = { 'rows': 3, 'columns': 3 };
        var actual = dimensions(a);
        assert.deepEqual(expected, actual);
    });

    it('should throw MatrixError when given an invalid matrix', () => {
        var a = [[1, 2, 3], [4, 5], [6, 7, 8]];
        assert.throws(() => dimensions(a), MatrixError,
            'Given matrix is invalid.');
    });

    it('should be integated to Array.prototype', () => {
        var expected = true;
        var actual = Array.prototype.hasOwnProperty('dimensions');
        assert.equal(expected, actual);
    });
});<commit_msg>test(coverage): achieve full test coverage for dimentions method<commit_after>import { dimensions, MatrixError } from '../source/matrix';
import assert from 'assert';


describe('matrix.dimensions', () => {
    it('should return the dimensions of an empty matrix', () => {
        var a = [];
        var expected = { 'rows': 0, 'columns': 0 };
        var actual = dimensions(a);
        assert.deepEqual(expected, actual);
    });

    it('should return the dimensions of a valid matrix', () => {
        var a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
        var expected = { 'rows': 3, 'columns': 3 };
        var actual = dimensions(a);
        assert.deepEqual(expected, actual);
    });

    it('should throw MatrixError when given an invalid matrix', () => {
        var a = [[1, 2, 3], [4, 5], [6, 7, 8]];
        assert.throws(() => dimensions(a), MatrixError,
            'Given matrix is invalid.');
    });

    it('should be integated to Array.prototype', () => {
        var expected = true;
        var actual = Array.prototype.hasOwnProperty('dimensions');
        assert.equal(expected, actual);
    });

    it('should return matrix dimensions through the Array.prototype '
    + 'property', () => {
        var a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
        var expected = { 'rows': 3, 'columns': 3 };
        var actual = a.dimensions();
        assert.deepEqual(expected, actual);
    });
});
{'fraction_non_alphanumeric': 0.17419354838709677, 'fraction_numerical': 0.021370967741935483, 'mean_word_length': 2.5493562231759657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7361271', 'n_tokens_mistral': 763, 'n_tokens_neox': 708, 'n_words': 235}