The machine has no tests of its own -- tests/vm_test.c is the CLI -- so the new .gitea/workflows/ci.yml checks the behaviours the README advertises instead: serial ASCII by default (--input R8F prints R8F), -n still printing decimal words (and.rot8 -> 512 1536 512), a 1 bit cell defaulting to numeric, the two contradictory flag combinations exiting 2, 7E1 round tripping one character, and --dump still drawing the 259 cell window. --help has to keep documenting both modes. All of those were run by hand against the built binary before the workflow was written; keep them in sync with the README when a mode changes.
This commit is contained in:
1 parent
a4df21a47e
commit
c1e4e166e4
1 file changed
+56
@@ -0,0 +1,56 @@
|
||||
# Gitea act_runner. Labels: point `runs-on` at whatever your runner advertises.
|
||||
#
|
||||
# The machine has no test suite of its own (tests/vm_test.c *is* the CLI), so the
|
||||
# checks below are the promises the README makes about I/O and geometry. Keep
|
||||
# them in sync with the README when a mode changes.
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: "41 3 * * *" # nightly: the same checks on a clean build
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
smoke:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: configure
|
||||
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||
- name: build
|
||||
run: cmake --build build -j"$(nproc)"
|
||||
- name: I/O modes and geometry
|
||||
run: |
|
||||
set -eu
|
||||
exe=./build/rot8_test
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
|
||||
# serial ASCII is the default for cells >= 8 bits
|
||||
out=$($exe --input R8F tapes/serial_echo.rot8)
|
||||
[ "$out" = "R8F" ] || fail "serial default printed '$out'"
|
||||
|
||||
# -n / --numbers is the old decimal word at a time mode
|
||||
out=$($exe -n tapes/and.rot8 | tr '\n' ' ')
|
||||
[ "$out" = "512 1536 512 " ] || fail "-n and.rot8 printed '$out'"
|
||||
|
||||
# a narrow cell has no room for a character: numeric by default
|
||||
out=$($exe --cell 1 tapes/and.rot8 | tr '\n' ' ')
|
||||
[ "$out" = "1 1 0 " ] || fail "--cell 1 and.rot8 printed '$out'"
|
||||
|
||||
# explicit serial on 7 bits, and -n next to serial framing, are errors
|
||||
$exe --serial --cell 1 tapes/and.rot8 >/dev/null 2>&1 && fail "--serial --cell 1 should fail"
|
||||
$exe --numbers --parity even tapes/and.rot8 >/dev/null 2>&1 && fail "--numbers --parity even should fail"
|
||||
|
||||
# 7E1 framing round trips one character through one cell
|
||||
out=$($exe --7e1 --input A tapes/serial_echo.rot8 | cut -c1)
|
||||
[ "$out" = "A" ] || fail "--7e1 printed '$out'"
|
||||
|
||||
# the default geometry still draws the tape (--dump prints a window line)
|
||||
$exe --dump tapes/wave.rot8 | grep -q "of 259 cells" || fail "--dump lost its window line"
|
||||
- name: usage text mentions both modes
|
||||
run: |
|
||||
set -eu
|
||||
./build/rot8_test --help | grep -q -- "--numbers" || { echo "FAIL: --help lost --numbers" >&2; exit 1; }
|
||||
./build/rot8_test --help | grep -q -- "--serial" || { echo "FAIL: --help lost --serial" >&2; exit 1; }
|
||||
Reference in new issue
Block a user