mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.1 geomath
This commit is contained in:
parent
ff3c26ab82
commit
d41c633e18
28
libraries/geomath/.arduino-ci.yml
Normal file
28
libraries/geomath/.arduino-ci.yml
Normal file
@ -0,0 +1,28 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
- uno
|
||||
# - due
|
||||
# - zero
|
||||
# - leonardo
|
||||
- m4
|
||||
- esp32
|
||||
- esp8266
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
4
libraries/geomath/.github/FUNDING.yml
vendored
Normal file
4
libraries/geomath/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: RobTillaart
|
||||
|
13
libraries/geomath/.github/workflows/arduino-lint.yml
vendored
Normal file
13
libraries/geomath/.github/workflows/arduino-lint.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
name: Arduino-lint
|
||||
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: arduino/arduino-lint-action@v1
|
||||
with:
|
||||
library-manager: update
|
||||
compliance: strict
|
17
libraries/geomath/.github/workflows/arduino_test_runner.yml
vendored
Normal file
17
libraries/geomath/.github/workflows/arduino_test_runner.yml
vendored
Normal file
@ -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
|
18
libraries/geomath/.github/workflows/jsoncheck.yml
vendored
Normal file
18
libraries/geomath/.github/workflows/jsoncheck.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
name: JSON check
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.json'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: json-syntax-check
|
||||
uses: limitusus/json-syntax-check@v1
|
||||
with:
|
||||
pattern: "\\.json$"
|
||||
|
17
libraries/geomath/CHANGELOG.md
Normal file
17
libraries/geomath/CHANGELOG.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Change Log GEOMATH
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.1.1] - 2023-09-24
|
||||
- first released version
|
||||
|
||||
|
||||
## [0.1.0] - 2015-07-18
|
||||
- initial version fastHaverSine (a.o.)
|
||||
|
||||
|
||||
|
21
libraries/geomath/LICENSE
Normal file
21
libraries/geomath/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015-2023 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
89
libraries/geomath/README.md
Normal file
89
libraries/geomath/README.md
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
[![Arduino CI](https://github.com/RobTillaart/geomath/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/geomath/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/geomath/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/geomath/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/geomath/actions/workflows/jsoncheck.yml)
|
||||
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/geomath.svg)](https://github.com/RobTillaart/geomath/issues)
|
||||
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/geomath/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/geomath.svg?maxAge=3600)](https://github.com/RobTillaart/geomath/releases)
|
||||
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/geomath.svg)](https://registry.platformio.org/libraries/robtillaart/geomath)
|
||||
|
||||
|
||||
# Geomath
|
||||
|
||||
Library for geographical math functions.
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
Experimental library, use with care.
|
||||
|
||||
The geomath library is a collection of functions for doing math in a geographical context.
|
||||
The library act primary as a placeholder for these related functions.
|
||||
|
||||
Wrote them long ago and share them because they might be useful e.g.
|
||||
for educational purposes.
|
||||
|
||||
|
||||
#### related
|
||||
|
||||
- https://github.com/RobTillaart/AtomicWeight
|
||||
- https://github.com/RobTillaart/printHelpers (to print scientific notation)
|
||||
|
||||
|
||||
## Interface
|
||||
|
||||
```cpp
|
||||
#include geomath.h
|
||||
```
|
||||
|
||||
#### Sphere class
|
||||
|
||||
Placeholder for some math
|
||||
|
||||
- **sphere(float radius)** constructor,
|
||||
constructs a sphere (planet) with a certain radius.
|
||||
- **float circumference(float latitude) returns the length in same units as used in constructor.
|
||||
- **float angle(float distance)** returns the angle between two points,
|
||||
given the distance. (E.g. Tokio Buenos Aires)
|
||||
|
||||
|
||||
#### Haversine
|
||||
|
||||
To calculate the distance between two points with longitude and lattitude.
|
||||
|
||||
- **double haverSine((double lat1, double lon1, double lat2, double lon2)**
|
||||
- **double fastHaverSine(double lat1, double lon1, double lat2, double lon2)**
|
||||
|
||||
|
||||
## Future
|
||||
|
||||
#### Must
|
||||
|
||||
- update documentation
|
||||
- need more math
|
||||
|
||||
|
||||
#### Should
|
||||
|
||||
- add more functions
|
||||
- add unit tests
|
||||
- escape velocity math
|
||||
- heat inside earth ?
|
||||
- find my sunset/sunrise formulas.
|
||||
|
||||
|
||||
#### Could
|
||||
|
||||
|
||||
#### Wont
|
||||
|
||||
|
||||
## Support
|
||||
|
||||
If you appreciate my libraries, you can support the development and maintenance.
|
||||
Improve the quality of the libraries by providing issues and Pull Requests, or
|
||||
donate through PayPal or GitHub sponsors.
|
||||
|
||||
Thank you,
|
||||
|
183
libraries/geomath/examples/fastHaverSine/fastHaverSine.ino
Normal file
183
libraries/geomath/examples/fastHaverSine/fastHaverSine.ino
Normal file
@ -0,0 +1,183 @@
|
||||
//
|
||||
// FILE: fastHaverSine.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.01
|
||||
// PURPOSE: fastHaverSine is a faster function than haversine for short distances (< 1km).
|
||||
// DATE: 2015-07-18
|
||||
// URL: http://forum.arduino.cc/index.php?topic=336729
|
||||
|
||||
|
||||
#define NUMTESTS 8
|
||||
|
||||
float ts[NUMTESTS][4] = {
|
||||
{50, 5, 51, 5},
|
||||
{50, 5, 50, 6},
|
||||
{50, 5, 50.1, 5},
|
||||
{50, 5, 50, 5.1},
|
||||
{50, 5, 50.1, 5.1},
|
||||
{50, 5, 50.01, 5.01},
|
||||
{50, 5, 50.001, 5.001},
|
||||
{50, 5, 50.0001, 5.0001},
|
||||
};
|
||||
|
||||
|
||||
uint32_t start;
|
||||
uint32_t stop;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println("Start fastHaverSine()");
|
||||
|
||||
start = micros();
|
||||
float d = HaverSine(50, 5, 50.01, 5.01);
|
||||
stop = micros();
|
||||
Serial.println("HAVERSINE");
|
||||
Serial.print("TIME: ");
|
||||
Serial.println(stop - start);
|
||||
Serial.print("DIST: ");
|
||||
Serial.println(d);
|
||||
|
||||
start = micros();
|
||||
d = fastHaverSine(50, 5, 50.01, 5.01);
|
||||
stop = micros();
|
||||
Serial.println("\nFASTHAVERSINE");
|
||||
Serial.print("TIME: ");
|
||||
Serial.println(stop - start);
|
||||
Serial.print("DIST: ");
|
||||
Serial.println(d);
|
||||
|
||||
start = micros();
|
||||
d = fastHaverSine2(50, 5, 50.01, 5.01);
|
||||
stop = micros();
|
||||
Serial.println("\nFASTHAVERSINE2");
|
||||
Serial.print("TIME: ");
|
||||
Serial.println(stop - start);
|
||||
Serial.print("DIST: ");
|
||||
Serial.println(d);
|
||||
|
||||
for (int i = 0; i < NUMTESTS; i++)
|
||||
{
|
||||
Serial.print("\ntest: ");
|
||||
Serial.print(i);
|
||||
Serial.print("\t\t");
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
Serial.print("\t");
|
||||
Serial.print(ts[i][j], 1);
|
||||
}
|
||||
Serial.println();
|
||||
d = HaverSine(ts[i][0], ts[i][1], ts[i][2], ts[i][3]);
|
||||
Serial.println(d);
|
||||
d = fastHaverSine(ts[i][0], ts[i][1], ts[i][2], ts[i][3]);
|
||||
Serial.println(d);
|
||||
}
|
||||
|
||||
Serial.println("\nrelative error map test\nLAT/LONG:\t45-50\nSTEPSIZE:\t0.2 degrees");
|
||||
float y = 45.0;
|
||||
while (y <= 50.0)
|
||||
{
|
||||
float x = 45.0;
|
||||
while (x <= 50.0)
|
||||
{
|
||||
float d1 = HaverSine(45.0, 45.0, x, y);
|
||||
float d2 = fastHaverSine(45.0, 45.0, x, y);
|
||||
float relError = 100.0 * abs(d2 - d1) / d1;
|
||||
Serial.print(relError, 3);
|
||||
Serial.print("\t");
|
||||
x += 0.2;
|
||||
}
|
||||
Serial.println();
|
||||
y += 0.2;
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
|
||||
Serial.println("\nrelative error map test\nLAT/LONG:\t45-46\nSTEPSIZE:\t0.05 degrees");
|
||||
y = 45.0;
|
||||
while (y <= 46.0)
|
||||
{
|
||||
float x = 45.0;
|
||||
while (x <= 46.0)
|
||||
{
|
||||
float d1 = HaverSine(45.0, 45.0, x, y);
|
||||
float d2 = fastHaverSine(45.0, 45.0, x, y);
|
||||
float relError = 100.0 * abs(d2 - d1) / d1;
|
||||
Serial.print(relError, 3);
|
||||
Serial.print("\t");
|
||||
x += 0.05;
|
||||
}
|
||||
Serial.println();
|
||||
y += 0.05;
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
|
||||
Serial.println("\nrelative error map test\nLAT/LONG:\t45-45.1\nSTEPSIZE:\t0.005 degrees");
|
||||
y = 45.0;
|
||||
while (y <= 45.1)
|
||||
{
|
||||
float x = 45.0;
|
||||
while (x <= 45.1)
|
||||
{
|
||||
float d1 = HaverSine(45.0, 45.0, x, y);
|
||||
float d2 = fastHaverSine(45.0, 45.0, x, y);
|
||||
float relError = 100.0 * abs(d2 - d1) / d1;
|
||||
Serial.print(relError, 3);
|
||||
Serial.print("\t");
|
||||
x += 0.005;
|
||||
}
|
||||
Serial.println();
|
||||
y += 0.005;
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
|
||||
Serial.println("done...");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
double fastHaverSine(double lat1, double long1, double lat2, double long2)
|
||||
{
|
||||
// assume the sphere has circumference 1 on the equator
|
||||
// to keep the number in same order of magnitude
|
||||
// helps to keep precision
|
||||
double dx = lat2 - lat1;
|
||||
double dy = (long2 - long1) * cos(lat2 * (PI / 180.0));
|
||||
double dist = sqrt(dx * dx + dy * dy);
|
||||
return dist * 111194.93; // correct for earth sizes ;)
|
||||
}
|
||||
|
||||
double fastHaverSine2(double lat1, double long1, double lat2, double long2)
|
||||
{
|
||||
// assume the sphere has circumference 1 on the equator
|
||||
// to keep the number in same order of magnitude
|
||||
// helps to keep precision
|
||||
double dx = lat2 - lat1;
|
||||
double dy = (long2 - long1) * cos(lat2 * (PI / 180.0));
|
||||
return hypot(dx, dy) * 111194.93; // correct for earth sizes ;)
|
||||
}
|
||||
|
||||
double HaverSine(double lat1, double lon1, double lat2, double lon2)
|
||||
{
|
||||
double ToRad = PI / 180.0;
|
||||
double R = 6371000; // radius earth in meter
|
||||
|
||||
double dLat = (lat2 - lat1) * ToRad;
|
||||
double dLon = (lon2 - lon1) * ToRad;
|
||||
|
||||
double a = sin(dLat / 2) * sin(dLat / 2) +
|
||||
cos(lat1 * ToRad) * cos(lat2 * ToRad) *
|
||||
sin(dLon / 2) * sin(dLon / 2);
|
||||
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
|
||||
double d = R * c;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
40
libraries/geomath/examples/geomath_test01/geomath_test01.ino
Normal file
40
libraries/geomath/examples/geomath_test01/geomath_test01.ino
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// FILE: geomath_test01.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: geomath demo
|
||||
// URL: https://github.com/RobTillaart/geomath
|
||||
|
||||
|
||||
#include "geomath.h"
|
||||
|
||||
uint32_t start, stop;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("GEOMATH_LIB_VERSION: ");
|
||||
Serial.println(GEOMATH_LIB_VERSION);
|
||||
|
||||
sphere earth(6371.0088);
|
||||
|
||||
for (float lat = 0; lat <= 90; lat += 0.5) // 0.1
|
||||
{
|
||||
Serial.print(lat);
|
||||
Serial.print("\t");
|
||||
Serial.println(earth.circumference(lat));
|
||||
}
|
||||
|
||||
// returns the amount of degrees for a distance in km
|
||||
Serial.println(earth.angle(17), 6);
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
109
libraries/geomath/geomath.h
Normal file
109
libraries/geomath/geomath.h
Normal file
@ -0,0 +1,109 @@
|
||||
#pragma once
|
||||
//
|
||||
// FILE: geomath.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.1
|
||||
// DATE: 2015-07-18
|
||||
// PURPOSE: Arduino library with geographic math functions
|
||||
// URL: https://github.com/RobTillaart/geomath
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
#define GEOMATH_LIB_VERSION (F("0.1.1"))
|
||||
|
||||
|
||||
// collection of Math with latitude / longitude
|
||||
// use double for precision
|
||||
|
||||
/*
|
||||
|
||||
// DISTANCE
|
||||
double haverSine()
|
||||
double fastHaverSine()
|
||||
double radius(double lat, double radius);
|
||||
double equator(double radius);
|
||||
double angle(double radius, double distance); // angle between a person standing right in Iceland and Zambia
|
||||
|
||||
*/
|
||||
|
||||
|
||||
double fastHaverSine(double lat1, double long1, double lat2, double long2)
|
||||
{
|
||||
// assume the sphere has circumference 1 on the equator
|
||||
// to keep the number in same order of magnitude
|
||||
// helps to keep precision
|
||||
double dx = lat2 - lat1;
|
||||
double dy = (long2 - long1) * cos(lat2 * (PI / 180.0));
|
||||
double dist = sqrt(dx * dx + dy * dy);
|
||||
return dist * 111194.93; // correct for earth sizes ;)
|
||||
}
|
||||
|
||||
|
||||
double fastHaverSine2(double lat1, double long1, double lat2, double long2)
|
||||
{
|
||||
// assume the sphere has circumference 1 on the equator
|
||||
// to keep the number in same order of magnitude
|
||||
// helps to keep precision
|
||||
double dx = lat2 - lat1;
|
||||
double dy = (long2 - long1) * cos(lat2 * (PI / 180.0));
|
||||
return hypot(dx, dy) * 111194.93; // correct for earth sizes ;)
|
||||
}
|
||||
|
||||
|
||||
double HaverSine(double lat1, double lon1, double lat2, double lon2)
|
||||
{
|
||||
double ToRad = PI / 180.0;
|
||||
double R = 6371000; // radius earth in meter
|
||||
|
||||
double dLat = (lat2 - lat1) * ToRad;
|
||||
double dLon = (lon2 - lon1) * ToRad;
|
||||
|
||||
double a = sin(dLat / 2) * sin(dLat / 2) +
|
||||
cos(lat1 * ToRad) * cos(lat2 * ToRad) *
|
||||
sin(dLon / 2) * sin(dLon / 2);
|
||||
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
|
||||
double d = R * c;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// SPHERE CLASS
|
||||
//
|
||||
class sphere
|
||||
{
|
||||
public:
|
||||
sphere(float radius)
|
||||
{
|
||||
_radius = radius;
|
||||
}
|
||||
|
||||
// returns distance in same units as used in constructor.
|
||||
float circumference(float latitude)
|
||||
{
|
||||
return TWO_PI * _radius * cos(latitude * (PI / 180.0));
|
||||
}
|
||||
|
||||
// return degrees
|
||||
float angle(float distance)
|
||||
{
|
||||
float a = fmod(distance, _radius * TWO_PI) / _radius;
|
||||
return a * (180.0 / PI);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
float _radius;
|
||||
float _radius_twopi; // optimization.
|
||||
};
|
||||
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
14
libraries/geomath/keywords.txt
Normal file
14
libraries/geomath/keywords.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Syntax Colouring Map For geomath
|
||||
|
||||
# Data types (KEYWORD1)
|
||||
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
haverSine KEYWORD2
|
||||
fastHaverSine KEYWORD2
|
||||
|
||||
|
||||
|
||||
# Constants (LITERAL1)
|
||||
GEOMATH_LIB_VERSION LITERAL1
|
||||
|
23
libraries/geomath/library.json
Normal file
23
libraries/geomath/library.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "geomath",
|
||||
"keywords": "haverSine",
|
||||
"description": "Arduino library with geographic math functions.",
|
||||
"authors":
|
||||
[
|
||||
{
|
||||
"name": "Rob Tillaart",
|
||||
"email": "Rob.Tillaart@gmail.com",
|
||||
"maintainer": true
|
||||
}
|
||||
],
|
||||
"repository":
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/geomath.git"
|
||||
},
|
||||
"version": "0.1.1",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
"headers": "geomath.h"
|
||||
}
|
11
libraries/geomath/library.properties
Normal file
11
libraries/geomath/library.properties
Normal file
@ -0,0 +1,11 @@
|
||||
name=geomath
|
||||
version=0.1.1
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library with geographic math functions.
|
||||
paragraph=haverSine
|
||||
category=Other
|
||||
url=https://github.com/RobTillaart/geomath
|
||||
architectures=*
|
||||
includes=geomath.h
|
||||
depends=
|
50
libraries/geomath/test/unit_test_001.cpp
Normal file
50
libraries/geomath/test/unit_test_001.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
//
|
||||
// FILE: unit_test_001.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2023-09-24
|
||||
// PURPOSE: unit tests for the geomath library
|
||||
// https://github.com/RobTillaart/geomath
|
||||
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
|
||||
//
|
||||
|
||||
// supported assertions
|
||||
// ----------------------------
|
||||
// assertEqual(expected, actual)
|
||||
// assertNotEqual(expected, actual)
|
||||
// assertLess(expected, actual)
|
||||
// assertMore(expected, actual)
|
||||
// assertLessOrEqual(expected, actual)
|
||||
// assertMoreOrEqual(expected, actual)
|
||||
// assertTrue(actual)
|
||||
// assertFalse(actual)
|
||||
// assertNull(actual)
|
||||
|
||||
|
||||
#include <ArduinoUnitTests.h>
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "geomath.h"
|
||||
|
||||
#define A0 0
|
||||
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
fprintf(stderr, "GEOMATH_LIB_VERSION: %s\n", (char *) GEOMATH_LIB_VERSION);
|
||||
}
|
||||
|
||||
unittest_teardown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
unittest(test_constants)
|
||||
{
|
||||
assertEqualFloat(1, 1, 0.001);
|
||||
}
|
||||
|
||||
|
||||
unittest_main()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
Loading…
Reference in New Issue
Block a user