Arc tests

This commit is contained in:
Mark Tolmacs 2024-09-25 14:22:32 +02:00
parent f79fb899fc
commit 3fe73e79a6
No known key found for this signature in database
9 changed files with 80 additions and 76 deletions

View file

@ -0,0 +1,13 @@
import { cartesian2Polar, polar, radians } from "./angle";
import { point } from "./point";
describe("cartesian to polar coordinate conversion", () => {
it("converts values properly", () => {
expect(cartesian2Polar(point(12, 5))).toEqual(
polar(13, radians(Math.atan(5 / 12))),
);
expect(cartesian2Polar(point(5, 5))).toEqual(
polar(5 * Math.sqrt(2), radians(Math.PI / 4)),
);
});
});