Skip to content

graial/blink-arduino-cpputest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino blink with cpputest

This repo seeks to demonstrate the use of cpputest on an arduino project.

It contains:

It is failing to compile right now because it is unable to #import "ArduinoFake.h"

There is a single test in unit_tests/tests/. Right now it will pass because the following 2 lines (suggested on ArduinoFake's getting started section) are commented out:

#include "ArduinoFake.h" using namespace fakeit;

Build and compile

using Arduino-CLI

  1. Set environment variables (this FQBN is for the ESP32-nano): FQBN=arduino:esp32:nano_nora && PORT=</dev/ttyUSB0 OR COM3> && FILENAME=blink-arduino-cpputest.ino

2.Compile arduino-cli compile --fqbn $FQBN $FILENAME --output-dir build

  1. Upload arduino-cli upload -p $PORT --fqbn $FQBN $FILENAME --input-dir build

You can also chain the commands together like so: arduino-cli compile --fqbn $FQBN $FILENAME --output-dir build && arduino-cli upload -p $PORT --fqbn $FQBN $FILENAME --input-dir build

in case of this error on Linux: dfu-util: No DFU capable USB device available download and execute this script

Test

  1. Build the docker image (one time only, or on Dockerfile updates): sudo docker pull jwgrenning/cpputest-runner

  2. Run the tests: ./unit-tests/docker/run.sh "make -C unit-tests" or ./unit-tests/docker/run.sh "legacy-build make unit-tests ."

  3. Alternatively, install cpputest natively and run make all from within the unit_tests folder