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.180 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.179 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.178 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.177 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.176 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.175 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.174 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.173 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.172 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.171 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.170 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.169 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.167 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.166 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.165 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.164 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.163 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.162 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.161 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.160 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js