-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
181 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
compile: | ||
# Choosing to run compilation tests on 2 different Arduino platforms | ||
platforms: | ||
- uno | ||
- leonardo | ||
- due | ||
- zero |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
name=MultiMap | ||
version=0.1.2 | ||
version=0.1.3 | ||
author=Rob Tillaart <[email protected]> | ||
maintainer=Rob Tillaart <[email protected]> | ||
sentence=Library for fast non-linear interpolation by means of two arrays. | ||
paragraph= | ||
category=Data Processing | ||
url=https://github.com/RobTillaart/Arduino/MultiMap | ||
architectures=* | ||
includes=multimap.h | ||
includes=MultiMap.h | ||
depends= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// | ||
// FILE: unit_test_001.cpp | ||
// AUTHOR: Rob Tillaart | ||
// DATE: 2021-01-02 | ||
// PURPOSE: unit tests for the multiMap | ||
// https://github.com/RobTillaart/MultiMap | ||
// 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 <ArduinoUnitTests.h> | ||
|
||
#define assertEqualFloat(arg1, arg2, arg3) assertOp("assertEqualFloat", "expected", fabs(arg1 - arg2), compareLessOrEqual, "<=", "actual", arg3) | ||
// #define assertEqualINF(arg) assertOp("assertEqualINF", "expected", INFINITY, compareEqual, "==", "actual", arg) | ||
// #define assertEqualNAN(arg) assertOp("assertEqualNAN", "expected", true, compareEqual, "==", "actual", isnan(arg)) | ||
|
||
|
||
#include "MultiMap.h" | ||
|
||
|
||
unittest_setup() | ||
{ | ||
} | ||
|
||
unittest_teardown() | ||
{ | ||
} | ||
|
||
/* | ||
unittest(test_new_operator) | ||
{ | ||
assertEqualINF(exp(800)); | ||
assertEqualINF(0.0/0.0); | ||
assertEqualINF(42); | ||
assertEqualNAN(INFINITY - INFINITY); | ||
assertEqualNAN(0.0/0.0); | ||
assertEqualNAN(42); | ||
} | ||
*/ | ||
|
||
unittest(test_all) | ||
{ | ||
fprintf(stderr, "VERSION: %s\n", MULTIMAP_LIB_VERSION); | ||
|
||
// based on the distance example | ||
// out[] holds the distances in cm | ||
float out[] = {150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20}; | ||
// in[] holds the measured analogRead() values for that distance | ||
float in[] = { 90, 97, 105, 113, 124, 134, 147, 164, 185, 218, 255, 317, 408, 506}; | ||
|
||
assertEqualFloat(150.000, multiMap<float>(80, in, out, 14), 0.001); | ||
assertEqualFloat(136.250, multiMap<float>(100, in, out, 14), 0.001); | ||
assertEqualFloat(65.4545, multiMap<float>(200, in, out, 14), 0.001); | ||
assertEqualFloat(42.7419, multiMap<float>(300, in, out, 14), 0.001); | ||
assertEqualFloat(30.8791, multiMap<float>(400, in, out, 14), 0.001); | ||
assertEqualFloat(20.6122, multiMap<float>(500, in, out, 14), 0.001); | ||
assertEqualFloat(20.0000, multiMap<float>(600, in, out, 14), 0.001); | ||
} | ||
|
||
unittest_main() | ||
|
||
// -------- |