feat: core instruments

This commit is contained in:
2026-08-22 09:49:53 +05:00
parent 4ec2b418fd
commit 9ccc9f94ac
13 changed files with 829 additions and 2 deletions
+14
View File
@@ -0,0 +1,14 @@
import { expect } from 'vitest';
import type { PixelImage } from './types';
export function makeImage(width: number, height: number, pixels: number[][]): PixelImage {
const data = new Uint8ClampedArray(pixels.flat());
if (data.length !== width * height * 4) {
throw new Error(`Fixture mismatch: ${data.length} байт на ${width}x${height}`);
}
return { width, height, data };
}
export function expectImageEqual(actual: PixelImage, expectedPixels: number[][]): void {
expect([...actual.data]).toEqual(expectedPixels.flat());
}