<commit_before>const
    Eigen = require('../index.js'),
    Complex = Eigen.Complex,
    Matrix = Eigen.Matrix,
    Vector = Eigen.Vector,
    CMatrix = Eigen.CMatrix,
    CVector = Eigen.CVector,
    CMatrixBlock = Eigen.CMatrixBlock,
    RowVector = Eigen.RowVector,
    CRowVector = Eigen.CRowVector,
    CPartialPivLU = Eigen.CPartialPivLU,
    CFullPivLU = Eigen.CFullPivLU,
    should = require('should');

describe('CMatrix', function() {
  var mat;

  it('#CMatrix() should be a function', function() {
    CMatrix.should.be.a.Function;
  });

  it('should throw error when tried creating a complex matrix without rows and columns arguments', function() {
    (function() { new CMatrix(); }).should.throw('Tried creating a complex matrix without rows and columns arguments');
    (function() { new CMatrix(1); }).should.throw('Tried creating a complex matrix without rows and columns arguments');
    (function() { new CMatrix(1, 2); }).should.not.throw();
  });

  it('should be invoked with arguments rows and columns and return an object', function() {
    CMatrix(1,2).should.be.an.Object;
    (new CMatrix(3, 4)).should.be.an.Object;
  });

  it('#CMatrix(3, 2) should return the complex matrix of size 3x2', function() {
    cmat = CMatrix(3, 2);
    cmat.rows().should.equal(3);
    cmat.cols().should.equal(2);
  });

  beforeEach(function() {
    cmat = CMatrix(3, 3)
      .set(0, 0, Complex(1, 1))
      .set(0, 1, Complex(2, 2))
      .set(0, 2, Complex(3, 3))
      .set(1, 0, Complex(4, 4))
      .set(1, 1, Complex(5, 5))
      .set(1, 2, Complex(6, 6))
      .set(2, 0, Complex(7, 7))
      .set(2, 1, Complex(8, 8))
      .set(2, 2, Complex(9, 9));
  });

  it('#set() should throw message when row or column numbers are out of range', function() {
    cmat.set.should.be.a.Function;

    (function() {
      cmat.set(3, 0, 68);
    }).should.throw('The row or column number is out of range');
    (function() {
      cmat.set(-1, -2, 500);
    }).should.throw('The row or column number is out of range');<commit_msg>test: add testings of constructors of CMatrix<commit_after>const
    Eigen = require('../index.js'),
    Complex = Eigen.Complex,
    Matrix = Eigen.Matrix,
    Vector = Eigen.Vector,
    CMatrix = Eigen.CMatrix,
    CVector = Eigen.CVector,
    CMatrixBlock = Eigen.CMatrixBlock,
    RowVector = Eigen.RowVector,
    CRowVector = Eigen.CRowVector,
    CPartialPivLU = Eigen.CPartialPivLU,
    CFullPivLU = Eigen.CFullPivLU,
    should = require('should');

describe('CMatrix', function() {
  var mat;

  it('#CMatrix() should be a function', function() {
    CMatrix.should.be.a.Function;
  });

  it('should throw error when tried creating a complex matrix without rows and columns arguments', function() {
    (function() { new CMatrix(); }).should.throw('Tried creating a complex matrix without rows and columns arguments');
    (function() { new CMatrix(1); }).should.throw('Tried creating a complex matrix without rows and columns arguments');
    (function() { new CMatrix(1, 2); }).should.not.throw();
  });

  it('should be invoked with arguments rows and columns and return an object', function() {
    CMatrix(1,2).should.be.an.Object;
    (new CMatrix(3, 4)).should.be.an.Object;
  });

  it('#CMatrix(3, 2) should return the complex matrix of size 3x2', function() {
    cmat = CMatrix(3, 2);
    cmat.rows().should.equal(3);
    cmat.cols().should.equal(2);
  });

  beforeEach(function() {
    cmat = CMatrix(3, 3)
      .set(0, 0, Complex(1, 1))
      .set(0, 1, Complex(2, 2))
      .set(0, 2, Complex(3, 3))
      .set(1, 0, Complex(4, 4))
      .set(1, 1, Complex(5, 5))
      .set(1, 2, Complex(6, 6))
      .set(2, 0, Complex(7, 7))
      .set(2, 1, Complex(8, 8))
      .set(2, 2, Complex(9, 9));
  });

  it('#CMatrix() should created by Matrix', function() {
    var mat = new Matrix.Random(3, 3);
    var cmat2 = new CMatrix(mat);
    cmat2.visit(function(value, row, col) {
      value.equals(mat.get(row, col)).should.be.true;
    });
  });

  it('#CMatrix() should created by MatrixBlock', function() {
    var mat = new Matrix.Random(3, 3);
    var mblock = mat.block(0, 0, 3, 3);
    var cmat2 = new CMatrix(mblock);
    cmat2.visit(function(value, row, col) {
      value.equals(mblock.get(row, col)).should.be.true;
    });
  });

  it('#CMatrix() should created by Vector', function() {
    var vec = new Vector([
      1,
      2,
      3]);
    var cmat2 = new CMatrix(vec);
    cmat2.visit(function(value, row, col) {
      value.equals(vec.get(row)).should.be.true;
    });
  });

  it('#CMatrix() should created by VectorBlock', function() {
    var vec = new Vector([
      1,
      2,
      3]);
    var vblock = vec.col(0);
    var cmat2 = new CMatrix(vblock);
    cmat2.visit(function(value, row, col) {
      value.equals(vblock.get(row)).should.be.true;
    });
  });

  it('#CMatrix() should created by RowVector', function() {
    var rvec = new RowVector([1, 2, 3]);
    var cmat2 = new CMatrix(rvec);
    cmat2.visit(function(value, row, col) {
      value.equals(rvec.get(col)).should.be.true;
    });
  });

  it('#CMatrix() should created by RowVectorBlock', function() {
    var rvec = new RowVector([1, 2, 3]);
    var rvblock = rvec.row(0);
    var cmat2 = new CMatrix(rvblock);
    cmat2.visit(function(value, row, col) {
      value.equals(rvec.get(col)).should.be.true;
    });
  });

  it('#CMatrix() should created by CMatrix', function() {
    var cmat2 = new CMatrix(cmat);
    cmat2.equals(cmat).should.be.true;
  });

  it('#CMatrix() should created by CMatrixBlock', function() {
    var cmblock = cmat.block(0, 0, 3, 3);
    var cmat2 = new CMatrix(cmblock);
    cmat2.equals(cmblock).should.be.true;
  });

  it('#CMatrix() should created by CVector', function() {
    var cvec = new CVector([
      1,
      2,
      3]);
    var cmat2 = new CMatrix(cvec);
    cmat2.visit(function(value, row, col) {
      value.equals(cvec.get(row)).should.be.true;
    });
  });

  it('#CMatrix() should created by CVectorBlock', function() {
    var cvec = new CVector([
      1,
      2,
      3]);
    var cvblock = cvec.col(0);
    var cmat2 = new CMatrix(cvblock);
    cmat2.visit(function(value, row, col) {
      value.equals(cvblock.get(row)).should.be.true;
    });
  });

  it('#CMatrix() should created by RowVector', function() {
    var crvec = new CRowVector([1, 2, 3]);
    var cmat2 = new CMatrix(crvec);
    cmat2.visit(function(value, row, col) {
      value.equals(crvec.get(col)).should.be.true;
    });
  });

  it('#CMatrix() should created by RowVectorBlock', function() {
    var crvec = new CRowVector([1, 2, 3]);
    var crvblock = crvec.row(0);
    var cmat2 = new CMatrix(crvblock);
    cmat2.visit(function(value, row, col) {
      value.equals(crvec.get(col)).should.be.true;
    });
  });

  it('#set() should throw message when row or column numbers are out of range', function() {
    cmat.set.should.be.a.Function;

    (function() {
      cmat.set(3, 0, 68);
    }).should.throw('The row or column number is out of range');
    (function() {
      cmat.set(-1, -2, 500);
    }).should.throw('The row or column number is out of range');
{'fraction_non_alphanumeric': 0.16815517722578843, 'fraction_numerical': 0.026234998604521352, 'mean_word_length': 3.019629837352776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2682028', 'n_tokens_mistral': 2595, 'n_tokens_neox': 2464, 'n_words': 647}