pick and place editing working, saving and loading working
This commit is contained in:
35
test/trackSystemBench.test.ts
Normal file
35
test/trackSystemBench.test.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { assert } from "jsr:@std/assert";
|
||||
import { describe, it } from "jsr:@std/testing/bdd";
|
||||
import { TrackSystem } from "../track/system.ts";
|
||||
import { StraightTrack } from "../track/shapes.ts";
|
||||
import { testPerformance } from "./bench.ts";
|
||||
import { setDefaultContext } from "../lib/context.ts";
|
||||
|
||||
/**
|
||||
* Tests if a function can run a given number of iterations within a target frame time.
|
||||
* @param fn The function to test.
|
||||
* @param iterations Number of times to run the function per frame.
|
||||
* @param fps Target frames per second.
|
||||
*/
|
||||
Deno.test("Track System Benchmark", () => {
|
||||
console.log("Track System Benchmark - run within frame time");
|
||||
const mockDoodler = {
|
||||
fillCircle: () => {},
|
||||
line: () => {},
|
||||
};
|
||||
setDefaultContext({
|
||||
doodler: mockDoodler,
|
||||
});
|
||||
const mockTrack = new TrackSystem([]);
|
||||
for (let i = 0; i < 100; i++) {
|
||||
mockTrack.registerSegment(new StraightTrack());
|
||||
}
|
||||
|
||||
testPerformance(
|
||||
() => {
|
||||
mockTrack.findEnds();
|
||||
},
|
||||
10000,
|
||||
60,
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user