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.18 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.17 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.16 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.15 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.14 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.13 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.12 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.11 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.10 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.9 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.8 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.7 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.6 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.5 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.4 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.3 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.2 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.1 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.1.0 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js
trackler-2.2.0.6 tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js