Skip to content

Commit 7f1391e

Browse files
committed
Add testCase
1 parent a5cfaf3 commit 7f1391e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/__tests__/matrix/projection.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { toBeDeepCloseTo } from 'jest-matcher-deep-close-to';
2+
3+
import { Matrix, projection } from '../..';
4+
5+
expect.extend({ toBeDeepCloseTo });
6+
7+
describe('Projection', () => {
8+
it('Projection I', () => {
9+
let vector = new Matrix([1, 2, 3]);
10+
let vectorSpace = new Matrix([[2, 5, -1], [-2, 1, 1]]);
11+
12+
let projVector = Matrix.empty(1, 3);
13+
14+
let expected = new Matrix([-2 / 5, 2, 1 / 5]);
15+
16+
projVector = projection(vector, vectorSpace);
17+
18+
expect(projVector).toBeDeepCloseTo(expected);
19+
});
20+
});

0 commit comments

Comments
 (0)