Files
lilygo-t-deck/emulator/tests/shim_globals.cpp
T
Dejvino a1d0730124 NetDeck: headless test runner — unit + integration suites, E2E as separate build
- emulator/tests/: harness.h (TEST/EXPECT framework, input + serial +
  framebuffer helpers), shim_globals.cpp (shim externs for test binaries,
  replacing main.cpp ownership)
- unit_tests.h (14): map/door/LOS/BFS/cover/link state machine/trace/
  spike/reinforcement/win/loss/reset — deterministic fixed-seed, sim
  stepped tick by tick
- integration_tests.h (7): keyboard->pollKeyboard->handleKey pipeline,
  beacon clicks -> squad movement, full network journey via clicks,
  hover-sever (incl. safe sever during trace), daemon gating
- e2e_tests.cpp (separate NetDeck-e2e build): real setup()/loop() journeys
  with device-pipeline input injection (boot grace, 0x55 keyboard, GT911
  tap, trackball ISRs), transcript + pixel assertions (HUD, freeze tint)
- shim SerialSim: opt-in transcript ring for test assertions (off by
  default, interactive emulator unchanged)
- make netdeck-test / -unit / -e2e (root) and make test / test-unit /
  test-e2e (emulator/); tests/README.md documents the structure
- STATUS.md: test-structure note

Verified: make netdeck-test -> 14 unit + 7 integration + 3 E2E, 0 failures
2026-11-14 13:02:41 +01:00

37 lines
963 B
C++

/**
* @file shim_globals.cpp
* @brief Definitions of the shim globals that src/main.cpp normally owns.
*
* Both test binaries (NetDeck-tests, NetDeck-e2e) link this instead of
* main.cpp, so they get the shim environment without the SDL window/event
* host loop. The sketch itself is included by each test's own TU (single-TU
* inclusion, same trick main.cpp uses).
*/
#include "Arduino.h"
#include "TFT_eSPI.h"
#include "Wire.h"
#include "SPI.h"
namespace emu {
uint8_t pinLevels[64];
bool touchDown = false;
int touchX = 0, touchY = 0;
std::deque<uint8_t> keyboard;
bool quitRequested = false;
} // namespace emu
namespace emuGfx {
uint32_t fb[320 * 240];
SDL_Texture *tex = nullptr;
bool dirty = true;
} // namespace emuGfx
SerialSim Serial;
TwoWire Wire;
SPIClass SPI;
const FreeFontStub FreeSansBold24pt7b {0};
const FreeFontStub FreeSansBold18pt7b {0};
const FreeFontStub FreeSansOblique12pt7b {0};
const FreeFontStub FreeSans12pt7b {0};