upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/unit/stubs/esp_netif.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-17 01:31:49 +0530
committerYour Name <you@example.com>2026-05-17 01:31:49 +0530
commit347d29658959c7e4b368a15134c183f4ce7a25bc (patch)
tree362b3e40273e3c1435bdd0745de61006041bb803 /tests/unit/stubs/esp_netif.h
parent4c47ae188b288e7d24bd9566ab3e6a6805d9484f (diff)
Testing infrastructure: AGENTS.md rules + unit test framework + geohash tests (11/11 pass)
- Add AGENTS.md: full project context + mandatory testing rules for AI sessions - Add tests/unit/ with host-compiled C unit test infrastructure - Clean stubs approach: ESP-IDF type stubs in tests/unit/stubs/, no source modifications - Fix geohash.c bit extraction bug (3-byte span) found by unit tests - test_geohash: 11/11 passing with reference vectors (Munich, NYC, origin, boundaries)
Diffstat (limited to 'tests/unit/stubs/esp_netif.h')
-rw-r--r--tests/unit/stubs/esp_netif.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/stubs/esp_netif.h b/tests/unit/stubs/esp_netif.h
new file mode 100644
index 0000000..f009537
--- /dev/null
+++ b/tests/unit/stubs/esp_netif.h
@@ -0,0 +1,17 @@
1#ifndef STUBS_ESP_NETIF_H
2#define STUBS_ESP_NETIF_H
3
4#include <stdint.h>
5
6typedef struct {
7 uint32_t addr;
8} esp_ip4_addr_t;
9
10#define IPSTR "%d.%d.%d.%d"
11#define IP2STR(ip) ((ip)->addr & 0xff), (((ip)->addr >> 8) & 0xff), (((ip)->addr >> 16) & 0xff), (((ip)->addr >> 24) & 0xff)
12
13static inline void IP4_ADDR(esp_ip4_addr_t *ip, uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
14 ip->addr = ((uint32_t)a) | ((uint32_t)b << 8) | ((uint32_t)c << 16) | ((uint32_t)d << 24);
15}
16
17#endif