Skip to content

Commit

Permalink
Add testCase
Browse files Browse the repository at this point in the history
  • Loading branch information
Goneiross committed Nov 29, 2018
1 parent a5cfaf3 commit 7f1391e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/__tests__/matrix/projection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { toBeDeepCloseTo } from 'jest-matcher-deep-close-to';

import { Matrix, projection } from '../..';

expect.extend({ toBeDeepCloseTo });

describe('Projection', () => {
it('Projection I', () => {
let vector = new Matrix([1, 2, 3]);
let vectorSpace = new Matrix([[2, 5, -1], [-2, 1, 1]]);

let projVector = Matrix.empty(1, 3);

let expected = new Matrix([-2 / 5, 2, 1 / 5]);

projVector = projection(vector, vectorSpace);

expect(projVector).toBeDeepCloseTo(expected);
});
});

0 comments on commit 7f1391e

Please sign in to comment.