diff --git a/.arduino-ci.yml b/.arduino-ci.yml new file mode 100644 index 0000000..26947a9 --- /dev/null +++ b/.arduino-ci.yml @@ -0,0 +1,11 @@ +compile: + # Choosing to run compilation tests on 2 different Arduino platforms + platforms: + - uno + - leonardo + - due + - zero +unittest: + # These dependent libraries will be installed + libraries: + - "OneWire" \ No newline at end of file diff --git a/.github/workflows/arduino-lint.yml b/.github/workflows/arduino-lint.yml new file mode 100644 index 0000000..87f6b18 --- /dev/null +++ b/.github/workflows/arduino-lint.yml @@ -0,0 +1,10 @@ +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: arduino/arduino-lint-action@v1 + with: + library-manager: update + compliance: strict \ No newline at end of file diff --git a/.github/workflows/arduino_test_runner.yml b/.github/workflows/arduino_test_runner.yml new file mode 100644 index 0000000..476456b --- /dev/null +++ b/.github/workflows/arduino_test_runner.yml @@ -0,0 +1,13 @@ +--- +name: Arduino CI + +on: [push, pull_request] + +jobs: + arduino_ci: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: Arduino-CI/action@master + # Arduino-CI/action@v0.1.1 diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml new file mode 100644 index 0000000..04603d0 --- /dev/null +++ b/.github/workflows/jsoncheck.yml @@ -0,0 +1,18 @@ +name: JSON check + +on: + push: + paths: + - '**.json' + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: json-syntax-check + uses: limitusus/json-syntax-check@v1 + with: + pattern: "\\.json$" + diff --git a/test/unit_test_001.cpp_disabled b/test/unit_test_001.cpp_disabled new file mode 100644 index 0000000..ea7fbd6 --- /dev/null +++ b/test/unit_test_001.cpp_disabled @@ -0,0 +1,95 @@ + +// DISABLED AS NOT ALL STD LIBRARIES ARE MOCKED / INCLUDEABLE + + +// +// FILE: unit_test_001.cpp +// AUTHOR: Miles Burton / Rob Tillaart +// DATE: 2021-01-10 +// PURPOSE: unit tests for the Arduino-Temperature-Control-Library +// https://github.com/MilesBurton/Arduino-Temperature-Control-Library +// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md +// + +// 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" + +/* + + +// BASED UPON SIMPLE +// + + +#include "OneWire.h" +#include "DallasTemperature.h" + +// Data wire is plugged into port 2 on the Arduino +#define ONE_WIRE_BUS 2 + +// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) +OneWire oneWire(ONE_WIRE_BUS); + +// Pass our oneWire reference to Dallas Temperature. +DallasTemperature sensors(&oneWire); + + + +unittest_setup() +{ +} + +unittest_teardown() +{ +} + + + +unittest(test_constructor) +{ + fprintf(stderr, "VERSION: %s\n", DALLASTEMPLIBVERSION); + + sensors.begin(); + sensors.requestTemperatures(); + float tempC = sensors.getTempCByIndex(0); + if(tempC != DEVICE_DISCONNECTED_C) + { + fprintf(stderr, "Temperature for the device 1 (index 0) is: "); + fprintf(stderr, "5f\n", tempC); + } + else + { + fprintf(stderr, "Error: Could not read temperature data\n"); + } + + assertEqual(1, 1); // keep unit test happy +} +*/ + +unittest_main() + +// --------