mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
Adds an [env:native] for host-side unit tests (pio test -e native) with a minimal Arduino.h stub, and covers the Utils helpers: _trim, toBoolean, SETCHARPROP, sortArray and the Timestamp conversions. The firmware envs now extend a shared [esp32] section instead of [env] so the native env doesn't inherit the Arduino framework, the ESP32 libraries or the build scripts. The half-hour calcTZOffset cases fail: +05:30 comes back as 2300. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
591 B
C++
20 lines
591 B
C++
// Minimal stand-in for the Arduino core so firmware sources can be built for
|
|
// the native test env (pio test -e native). Only add what tested code uses.
|
|
#ifndef arduino_stub_h
|
|
#define arduino_stub_h
|
|
#include <cctype>
|
|
#include <cmath>
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <ctime>
|
|
|
|
// Fixed so anything formatted from it is deterministic.
|
|
inline unsigned long millis() { return 0; }
|
|
inline bool getLocalTime(struct tm *info, uint32_t ms = 5000) {
|
|
(void)ms;
|
|
time_t now = time(nullptr);
|
|
return localtime_r(&now, info) != nullptr;
|
|
}
|
|
#endif
|