Files
HaloKeymind/test/mocks/Arduino.h
T
agessaman 40635a53c4 test(native): declare stdlib in the Arduino mock so ConfigSerializer builds
The real Arduino.h includes stdlib.h, so ConfigSerializer.cpp reaches atoi,
atol and atof through it and compiles on device. The mock supplied only
cstdint, cmath and Stream.h, leaving those undeclared — and since the native
env compiles ConfigSerializer.cpp into every suite via build_src_filter, all
21 suites errored rather than just its own.

Fixing the mock keeps src/ identical to upstream and covers any other source
relying on the same transitive include.

pio test -e native: 297 test cases, 297 succeeded.
2026-08-14 09:05:05 -07:00

25 lines
486 B
C++

#pragma once
#include <cstdint>
#include <cmath>
// The real Arduino.h pulls in stdlib.h, so device code reaches atoi/atol/atof/strtoul
// without including it. Mirror that here or those sources fail only on the native build.
#include <cstdlib>
#include "Stream.h"
using std::atof;
using std::atoi;
using std::atol;
inline uint32_t g_mock_millis = 0;
using std::isnan;
inline uint32_t millis() {
return g_mock_millis;
}
inline void delay(uint32_t ms) {
g_mock_millis += ms;
}