|
| 1 | +import { Matrix } from './matrix'; |
| 2 | + |
| 3 | +describe('Matrix', () => { |
| 4 | + test('extract row from one number matrix', () => { |
| 5 | + expect(new Matrix('1').rows[0]).toEqual([1]); |
| 6 | + }); |
| 7 | + |
| 8 | + xtest('can extract row', () => { |
| 9 | + expect(new Matrix('1 2\n3 4').rows[1]).toEqual([3, 4]); |
| 10 | + }); |
| 11 | + |
| 12 | + xtest('extract row where numbers have different widths', () => { |
| 13 | + expect(new Matrix('1 2\n10 20').rows[1]).toEqual([10, 20]); |
| 14 | + }); |
| 15 | + |
| 16 | + xtest('can extract row from non-square matrix with no corresponding column', () => { |
| 17 | + expect(new Matrix('1 2 3\n4 5 6\n7 8 9\n8 7 6').rows[3]).toEqual([8, 7, 6]); |
| 18 | + }); |
| 19 | + |
| 20 | + xtest('extract column from one number matrix', () => { |
| 21 | + expect(new Matrix('1').columns[0]).toEqual([1]); |
| 22 | + }); |
| 23 | + |
| 24 | + xtest('can extract column', () => { |
| 25 | + expect(new Matrix('1 2 3\n4 5 6\n7 8 9').columns[2]).toEqual([3, 6, 9]); |
| 26 | + }); |
| 27 | + |
| 28 | + xtest('can extract column from non-square matrix with no corresponding row', () => { |
| 29 | + expect(new Matrix('1 2 3 4\n5 6 7 8\n9 8 7 6').columns[3]).toEqual([4, 8, 6]); |
| 30 | + }); |
| 31 | + |
| 32 | + xtest('can extract column from non-square matrix with more columns than rows', () => { |
| 33 | + expect(new Matrix('1 2 3\n4 5 6').columns[2]).toEqual([3, 6]); |
| 34 | + }); |
| 35 | + |
| 36 | + xtest('extract column where numbers have different widths', () => { |
| 37 | + expect(new Matrix('89 1903 3\n18 3 1\n9 4 800').columns[1]).toEqual([1903, 3, 4]); |
| 38 | + }); |
| 39 | +}); |
0 commit comments