Math.hypot.js 366 B

123456789
  1. test("basic functionality", () => {
  2. expect(Math.hypot(3, 4)).toBe(5);
  3. expect(Math.hypot(3, 4, 5)).toBeCloseTo(7.0710678118654755);
  4. expect(Math.hypot()).toBe(0);
  5. expect(Math.hypot(NaN)).toBe(NaN);
  6. expect(Math.hypot(3, 4, "foo")).toBe(NaN);
  7. expect(Math.hypot(3, 4, "5")).toBeCloseTo(7.0710678118654755);
  8. expect(Math.hypot(-3)).toBe(3);
  9. });