#!/bin/sh # Host-side tests for the mapping and power-clamp logic. # Compiles the real firmware sources against stubbed Circle headers, across # every configuration variant that changes the rendering path. set -e cd "$(dirname "$0")/.." OUT=$(mktemp -d) trap 'rm -rf "$OUT"' EXIT FAIL=0 for CFG in \ "default:" \ "reversed strip:-DSTRIP_REVERSED=1" \ "velocity insensitive:-DVELOCITY_SENSITIVE=0" \ "reversed + velocity insensitive:-DSTRIP_REVERSED=1 -DVELOCITY_SENSITIVE=0" \ "full brightness:-DGLOBAL_BRIGHTNESS=255" \ "tight key cap:-DMAX_LIT_KEYS=5" \ "single LED per key:-DLEDS_PER_KEY=1" \ "three LEDs per key:-DLEDS_PER_KEY=3" \ "hints disabled:-DHINT_MIDI_CHANNEL=MIDI_CHANNEL_NONE" \ "linear map:-DNOTE_MAP_GEOMETRIC=0" \ "linear map reversed:-DNOTE_MAP_GEOMETRIC=0 -DSTRIP_REVERSED=1" \ "positive offset:-DLED_OFFSET=3" \ "negative offset:-DLED_OFFSET=-2" \ "offset reversed:-DLED_OFFSET=4 -DSTRIP_REVERSED=1" \ ; do NAME=${CFG%%:*} FLAGS=${CFG#*:} printf '\n=== %s ===\n' "$NAME" g++ -std=c++17 -Wall -Wextra -Wno-unused-parameter $FLAGS \ -o "$OUT/t" -Itests/stubs -Isrc \ tests/test_pianoleds.cpp src/pianoleds.cpp "$OUT/t" || FAIL=1 done printf '\n' if [ $FAIL -ne 0 ]; then echo "SOME CONFIGURATIONS FAILED"; exit 1; fi echo "all configurations passed"