From bd36792d48ad951bd8b11b610074ebf8d186707a Mon Sep 17 00:00:00 2001 From: "trent.wyatt" Date: Sun, 28 Jan 2024 02:08:34 -0600 Subject: [PATCH] add CI test --- .arduino-ci.yml | 2 + .github/workflows/arduino_test_runner.yml | 17 +++++++ test/unit_test_001.cpp | 56 +++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/arduino_test_runner.yml create mode 100644 test/unit_test_001.cpp diff --git a/.arduino-ci.yml b/.arduino-ci.yml index 5585b5c..4661da9 100644 --- a/.arduino-ci.yml +++ b/.arduino-ci.yml @@ -20,6 +20,8 @@ compile: # - esp32 # - esp8266 # - rpipico + libraries: + - "Servo" libraries: - "Servo" diff --git a/.github/workflows/arduino_test_runner.yml b/.github/workflows/arduino_test_runner.yml new file mode 100644 index 0000000..fadfa90 --- /dev/null +++ b/.github/workflows/arduino_test_runner.yml @@ -0,0 +1,17 @@ +--- +name: Arduino CI + +on: [push, pull_request] + +jobs: + runTest: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - run: | + gem install arduino_ci + arduino_ci.rb diff --git a/test/unit_test_001.cpp b/test/unit_test_001.cpp new file mode 100644 index 0000000..3d02b0c --- /dev/null +++ b/test/unit_test_001.cpp @@ -0,0 +1,56 @@ +// +// FILE: unit_test_001.cpp +// AUTHOR: Trent M. Wyatt +// DATE: 2024-01-04 +// PURPOSE: unit tests for ArduinoCLI library +// https://github.com/RobTillaart/SIMON +// + + +// supported assertions +// ---------------------------- +// assertEqual(expected, actual); // a == b +// assertNotEqual(unwanted, actual); // a != b +// assertComparativeEquivalent(expected, actual); // abs(a - b) == 0 or (!(a > b) && !(a < b)) +// assertComparativeNotEquivalent(unwanted, actual); // abs(a - b) > 0 or ((a > b) || (a < b)) +// assertLess(upperBound, actual); // a < b +// assertMore(lowerBound, actual); // a > b +// assertLessOrEqual(upperBound, actual); // a <= b +// assertMoreOrEqual(lowerBound, actual); // a >= b +// assertTrue(actual); +// assertFalse(actual); +// assertNull(actual); + +// // special cases for floats +// assertEqualFloat(expected, actual, epsilon); // fabs(a - b) <= epsilon +// assertNotEqualFloat(unwanted, actual, epsilon); // fabs(a - b) >= epsilon +// assertInfinity(actual); // isinf(a) +// assertNotInfinity(actual); // !isinf(a) +// assertNAN(arg); // isnan(a) +// assertNotNAN(arg); // !isnan(a) + + +#include + +#include "Arduino.h" +#include "TomServo.h" + +unittest_setup() +{ + fprintf(stderr, "TomServo Library\n"); +} + + +unittest_teardown() +{ +} + +unittest(test_mock) +{ +} + +unittest_main() + +// -- END OF FILE -- + +