sica-fondt/src/endocrine/run_tests.sh
Claude ee640f62d7
Add Drive-Box R reference track (endocrine system + 4 drivers + nervous system)
Executable reference implementation of the Drive-Box endocrine/affective core,
built TDD with a dependency-free R test harness (no testthat; runs on bare
r-base-core). Foundations dropped in as-is; the four drivers and the coupling
layer were each driven from a failing test first.

Modules (src/endocrine/):
- endocrine_array.R : 30-channel affective vector field + visceral friction
- priors.R          : trauma/triumph salience records
- driver_energy.R   : hard gate, tool-lock, exponential drag, asymmetric tool cost
- driver_ps_plus.R  : aggregates endocrine + priors into existential load + arguments
- driver_ethical_integrity.R : antithesis penalty / alignment discount / conviction hardening
- driver_etr.R      : toroidal coordinate, magnitude status bands, update path
- drive_box.R       : the 'nervous system' -- afferent(PS+) -> modulate(Eth-Int)
                      -> efferent gate(Energy) -> regime(ETR); the 'full integration'
                      Energy.request_execution anticipated
- test_framework.R  : minimal assertion harness (expect_*/test_case/test_summary)
- run_tests.sh      : runs every test_*.R from repo root

Suite: 5 test files, 108 assertions, all green (run: bash src/endocrine/run_tests.sh).
An Ada/SPARK port to src/organs/drive_box/ is a later session; this track is its
behavior oracle.
2026-06-10 03:59:46 +00:00

42 lines
999 B
Bash
Executable File

#!/usr/bin/env bash
# Run every endocrine / Drive-Box R test from the repository root so that the
# repo-root-relative source() paths inside each test resolve correctly.
set -uo pipefail
# cd to repo root (this script lives at <root>/src/endocrine/run_tests.sh)
cd "$(dirname "$0")/../.." || exit 2
if ! command -v Rscript >/dev/null 2>&1; then
echo "ERROR: Rscript not found. Install with: sudo apt-get install -y r-base-core" >&2
exit 2
fi
status=0
shopt -s nullglob
# Collect test files, excluding the harness itself (test_framework.R).
tests=()
for f in src/endocrine/test_*.R; do
[ "$(basename "$f")" = "test_framework.R" ] && continue
tests+=("$f")
done
if [ ${#tests[@]} -eq 0 ]; then
echo "No test_*.R files found under src/endocrine/." >&2
exit 2
fi
for t in "${tests[@]}"; do
echo "== $t =="
if ! Rscript "$t"; then
status=1
fi
echo
done
if [ $status -eq 0 ]; then
echo "ALL ENDOCRINE TESTS PASSED"
else
echo "SOME ENDOCRINE TESTS FAILED"
fi
exit $status