57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
|
|
// benchmarks.test.ts - Validation tests for benchmark suites.
|
||
|
|
// Runs each benchmark with reduced parameters to verify correctness.
|
||
|
|
|
||
|
|
import { describe, it } from 'node:test'
|
||
|
|
import assert from 'node:assert'
|
||
|
|
|
||
|
|
import { runFolBenchmarks } from './fol-benchmark.js'
|
||
|
|
import { runPropertyBenchmarks } from './property-benchmark.js'
|
||
|
|
import { runRenderTargetBenchmarks } from './render-target-benchmark.js'
|
||
|
|
import { runPublicApiBenchmarks } from './public-api-benchmark.js'
|
||
|
|
|
||
|
|
describe('FOL benchmarks', () => {
|
||
|
|
it('runs forall benchmarks without error', async () => {
|
||
|
|
const results = await runFolBenchmarks();
|
||
|
|
assert.ok(results.length >= 4);
|
||
|
|
for (const r of results) {
|
||
|
|
assert.strictEqual(typeof r.meanDurationMs, 'number');
|
||
|
|
assert.ok(r.meanDurationMs >= 0);
|
||
|
|
assert.ok(r.runs.length > 0);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('Property benchmarks', () => {
|
||
|
|
it('runs enumerated and sampled benchmarks', async () => {
|
||
|
|
const results = await runPropertyBenchmarks();
|
||
|
|
assert.ok(results.length >= 2);
|
||
|
|
for (const r of results) {
|
||
|
|
assert.strictEqual(typeof r.meanDurationMs, 'number');
|
||
|
|
assert.ok(r.meanDurationMs >= 0);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('Render target benchmarks', () => {
|
||
|
|
it('runs renderer mount benchmarks', async () => {
|
||
|
|
const results = await runRenderTargetBenchmarks();
|
||
|
|
assert.ok(results.length >= 4);
|
||
|
|
for (const r of results) {
|
||
|
|
assert.strictEqual(typeof r.meanDurationMs, 'number');
|
||
|
|
assert.ok(r.meanDurationMs >= 0);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('Public API benchmarks', () => {
|
||
|
|
it('runs leftOf relation benchmark under 100ms', async () => {
|
||
|
|
const results = await runPublicApiBenchmarks();
|
||
|
|
assert.ok(results.length >= 1);
|
||
|
|
for (const r of results) {
|
||
|
|
assert.strictEqual(typeof r.meanDurationMs, 'number');
|
||
|
|
assert.ok(r.meanDurationMs >= 0);
|
||
|
|
assert.ok(r.meanDurationMs < 100, `Expected public API benchmark to complete in under 100ms, but took ${r.meanDurationMs}ms`);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|