Unit testing, library and ETL (Embedded Template Library)

I am quite new to platformio and trying to start my own library, but have run into a problem. The library is available here: BlackEdder / AODVRouter · GitLab

It depends on the Embedded Template Library (ETL) and I am trying to setup unit testing. To run my test I tried:

platformio ci --board=nodemcuv2 --lib="." test/test_main.cpp

But I get an error that seems to be ETL related:

Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_wiring.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_wiring_analog.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_wiring_digital.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_wiring_pulse.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_wiring_pwm.o
Compiling .pioenvs/nodemcuv2/FrameworkArduino/core_esp8266_wiring_shift.o
In file included from /home/edwin/.platformio/lib/Embedded Template Library_ID9
from /home/edwin/.platformio/lib/Embedded Template Library_ID930/src/basic_stri
from /home/edwin/.platformio/lib/Embedded Template Library_ID930/src/string.h:3
from /home/edwin/.platformio/lib/Embedded Template Library_ID930/src/bitset.h:3
from /home/edwin/.platformio/lib/Embedded Template Library_ID930/src/pool.h:36,
from /home/edwin/.platformio/lib/Embedded Template Library_ID930/src/imap.h:44,
from /home/edwin/.platformio/lib/Embedded Template Library_ID930/src/map.h:38,
from lib/aodvRouting/src/AODVRouter.h:4,
from src/test_main.cpp:1:
4.8.2/cstring:75:11: error: '::memchr' has not been declared
using ::memchr;
4.8.2/cstring:76:11: error: '::memcmp' has not been declared
using ::memcmp;
4.8.2/cstring:77:11: error: '::memcpy' has not been declared
using ::memcpy;

Is this a problem with ETL? Or is this a problem with how I am trying to run my tests.

Turns out I had an trailing .h after my includes. Still now I get complaints about undefined UNITY_BEGIN. Any way to include them without calling platformio test?

You have to use pio test or pio remote test commands instead of pio ci. See

That page suggest it would not work for a library though.

You need to create platformio.ini file in the root of your repo

; PlatformIO Project Configuration File
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = Embedded Template Library

platform = native
lib_deps = Embedded Template Library

Then run pio test in the project dir.

Thank you, so that means I need both a platformio.ini and a library.json? That seems quite redundant, but manageable.

The Embedded Template Library compiled fine, but when I try to run pio test I get loads of the following errors:

.piolibdeps/Embedded Template Library_ID930/src/array.h:469:3: error: template with C linkage
template <std::size_t I, typename T, std::size_t MAXN>

so I get the feeling I still have something setup wrong.

Does it work with Arduino IDE?