feat: core types, time, rng, model fetch
Co-Authored-By: Claude Haiku 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
0a6ec1dc40
commit
bac4fbeb1d
@@ -0,0 +1,10 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { createRng } from "../../src/core/rng.ts";
|
||||
|
||||
test("rng deterministic", () => {
|
||||
const a = createRng(42), b = createRng(42), c = createRng(43);
|
||||
const sa = [a.next(), a.next(), a.next()];
|
||||
expect([b.next(), b.next(), b.next()]).toEqual(sa);
|
||||
expect(c.next()).not.toBe(sa[0]);
|
||||
const r = createRng(1); for (let i = 0; i < 1000; i++) { const v = r.int(3, 5); expect(v >= 3 && v <= 5).toBe(true); }
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { ticksToSeconds, secondsToTicks } from "../../src/core/time.ts";
|
||||
|
||||
test("ticks/seconds", () => {
|
||||
expect(ticksToSeconds(960, 60)).toBeCloseTo(1);
|
||||
expect(ticksToSeconds(3840, 120)).toBeCloseTo(2);
|
||||
expect(secondsToTicks(0.5, 120)).toBeCloseTo(960);
|
||||
});
|
||||
Reference in New Issue
Block a user