Sha256: dfdaba901f33e3ee966b9cba82de37afbc8d289173ccc75a80fae61985330832

Contents?: true

Size: 1.24 KB

Versions: 185

Compression:

Stored size: 1.24 KB

Contents

import Matrix from './saddle-points';

describe('Matrix', () => {
  test('extracts a row', () => {
    const matrix = new Matrix('1 2\n10 20');
    expect(matrix.rows[0]).toEqual([1, 2]);
  });

  xtest('extracts other row', () => {
    const matrix = new Matrix('9 8 7\n19 18 17');
    expect(matrix.rows[1]).toEqual([19, 18, 17]);
  });

  xtest('extracts a column', () => {
    const matrix = new Matrix('1 2 3\n4 5 6\n7 8 9\n 8 7 6');
    expect(matrix.columns[0]).toEqual([1, 4, 7, 8]);
  });

  xtest('extracts another column', () => {
    const matrix = new Matrix('89 1903 3\n18 3 1\n9 4 800');
    expect(matrix.columns[1]).toEqual([1903, 3, 4]);
  });

  xtest('no saddle point', () => {
    const matrix = new Matrix('2 1\n1 2');
    expect(matrix.saddlePoints).toEqual([]);
  });

  xtest('a saddle point', () => {
    const matrix = new Matrix('1 2\n3 4');
    expect(matrix.saddlePoints).toEqual([[0, 1]]);
  });

  xtest('another saddle point', () => {
    const matrix = new Matrix('18 3 39 19 91\n38 10 8 77 320\n3 4 8 6 7');
    expect(matrix.saddlePoints).toEqual([[2, 2]]);
  });

  xtest('multiple saddle points', () => {
    const matrix = new Matrix('4 5 4\n3 5 5\n1 5 4');
    expect(matrix.saddlePoints).toEqual([[0, 1], [1, 1], [2, 1]]);
  });
});

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.138 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.137 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.136 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.135 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.134 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.133 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.132 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.131 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.130 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.129 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.128 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.127 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.126 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.125 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.124 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.123 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.122 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.121 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.120 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js