24 lines
561 B
TypeScript
24 lines
561 B
TypeScript
|
import { Vector2D } from '@/components/rects/rectangles';
|
||
|
import { expect } from "chai";
|
||
|
|
||
|
describe("Vector Tests", () => {
|
||
|
const v = new Vector2D(1, 2);
|
||
|
|
||
|
it("should create a vector", () => {
|
||
|
expect(v.x).to.equal(1);
|
||
|
expect(v.y).to.equal(2);
|
||
|
});
|
||
|
|
||
|
it("should add vectors", () => {
|
||
|
const v2 = v.plus(new Vector2D(3, 4));
|
||
|
expect(v2.x).to.equal(4);
|
||
|
expect(v2.y).to.equal(6);
|
||
|
});
|
||
|
|
||
|
it("should subtract vectors", () => {
|
||
|
const v2 = v.minus(new Vector2D(3, 4));
|
||
|
expect(v2.x).to.equal(-2);
|
||
|
expect(v2.y).to.equal(-2);
|
||
|
});
|
||
|
});
|