#!/usr/bin/env bash # Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # check-indexed.sh - Host gate for jlSurfacePasteIndexed and # jlSurfaceSnapIndexed: the BLANK port built with the host cc, and # tests/host/indexedHost.c pasting and snapping edge-case and seeded random # rectangles (odd columns, both edges, doubleWide bytes cut by an edge, rows # off both ends, the int16_t limits), each checked against a reference made # one pixel at a time with jlDrawPixel and jlSamplePixel; then the planar # ports' paste and snap (src/m68k/planarIndexed.c) on host buffers in both # planar layouts, separate and ST-interleaved. # # Usage: scripts/check-indexed.sh # Exit: 0 PASS, 1 FAIL set -euo pipefail repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) cc=${CC:-cc} work=$(mktemp -d -t joeylib-indexed.XXXXXX) trap 'rm -rf "$work"' EXIT cd "$repo" "$cc" -O2 -DJOEYLIB_PLATFORM_BLANK \ -Iinclude -Iinclude/joey -Isrc/core -Isrc/codegen -Isrc/m68k -Wall -Wextra -Werror \ src/core/*.c src/generic/*.c src/blank/blank.c \ src/m68k/planarIndexed.c src/m68k/planarHash.c tests/host/indexedHost.c \ -lm -o "$work/indexedHost" if "$work/indexedHost"; then echo "check-indexed: PASS (indexed paste and snap match the pixel-by-pixel reference, clipped at every edge, chunky and both planar layouts)" else echo "check-indexed: FAIL" exit 1 fi