Public Access
Add native unit tests for the Nano firmware
- New native environment: pio test -e native - test/mocks: fake Arduino core, EEPROM and recording BROSE9323 driver - test/test_nano: 25 tests covering every command, bitmaps, bad input, flip time storage and the periodic full redraw - Board environments ignore tests so they are never uploaded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
80f3f78152
commit
8415dee347
8 files changed
+505
-4
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// In-memory EEPROM for the native tests (starts erased, all 0xFF like a new chip)
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
class FakeEEPROM
|
||||
{
|
||||
public:
|
||||
uint8_t mem[1024];
|
||||
|
||||
FakeEEPROM() { erase(); }
|
||||
void erase() { memset(mem, 0xFF, sizeof(mem)); }
|
||||
|
||||
template <typename T>
|
||||
T &get(int addr, T &t)
|
||||
{
|
||||
memcpy(&t, mem + addr, sizeof(T));
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T &put(int addr, const T &t)
|
||||
{
|
||||
memcpy(mem + addr, &t, sizeof(T));
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
inline FakeEEPROM EEPROM;
|
||||
Reference in new issue
Block a user