import { log2 } from "../utils/number"; import { describe, it, expect } from "vitest"; describe("logarithm base-2", () => { describe("log2()", () => { it("should return the logarithm base-2 of a number", () => { expect(log2(4)).toBe(2); expect(log2(8)).toBe(3); // should be exact as it's an integer expect(log2(9)).toBeCloseTo(3.16992500144); // should be close to because it's a decimal value }); }); });