joeylib2/scripts/check-tilelayer.sh

32 lines
1.1 KiB
Bash
Executable file

#!/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-tilelayer.sh - Host gate for tile layers: the BLANK port built with
# the host cc, and tests/host/tileLayerHost.c checking every draw of 300 runs
# of random moves, bands, maps (some smaller than the view), and cell changes
# pixel for pixel against the map itself, plus the band's dirty marks, the
# rows outside it, and jlTileLayerCreate's refusals.
#
# Usage: scripts/check-tilelayer.sh
# Exit: 0 PASS, 1 FAIL
set -euo pipefail
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
cc=${CC:-cc}
work=$(mktemp -d -t joeylib-tilelayer.XXXXXX)
trap 'rm -rf "$work"' EXIT
cd "$repo"
"$cc" -O2 -DJOEYLIB_PLATFORM_BLANK \
-Iinclude -Iinclude/joey -Isrc/core -Isrc/codegen -Wall -Wextra -Werror \
src/core/*.c src/generic/*.c src/blank/blank.c tests/host/tileLayerHost.c \
-lm -o "$work/tileLayerHost"
if "$work/tileLayerHost"; then
echo "check-tilelayer: PASS (every draw matches the map pixel for pixel)"
else
echo "check-tilelayer: FAIL"
exit 1
fi