Sha256: 6303739a4359e6bc7261115f27fa030c6e1b0d0af457cc74e8d8cfe06ac855bd

Contents?: true

Size: 1.27 KB

Versions: 141

Compression:

Stored size: 1.27 KB

Contents

var Matrix = require('./saddle-points');

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

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

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

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

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

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

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

  xit('multiple saddle points', function () {
    var 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

141 entries across 141 versions & 1 rubygems

Version Path
trackler-2.2.1.38 tracks/javascript/exercises/saddle-points/saddle-points.spec.js