mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-09-26 23:27:57 +00:00
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.
25 lines
486 B
C++
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;
|
|
}
|