From bed3b20837ffbf40331a63c0530e439c0d060830 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 1 Feb 2021 23:56:27 -0800 Subject: [PATCH 01/61] Add issue templates A menu of issue categories will be presented when the user begins the issue creation process. The issue will be prefilled with prompts for the specific information needed for each issue type. If none of the issue types are applicable, the user can click the "Open a blank issue" link at the bottom of the issue template chooser page to get the previous issue creation behavior. The default organization level security policy is linked to for people wanting to report a security vulnerability. Links are provided to the Arduino Language Reference, Arduino Forum, and Arduino Developers Mailing list to redirect support requests. References: - https://docs.github.com/en/github/building-a-strong-community/about-issue-and-pull-request-templates - https://docs.github.com/en/github/building-a-strong-community/creating-a-pull-request-template-for-your-repository - https://docs.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser --- .github/ISSUE_TEMPLATE/api-deprecation.md | 25 ++++++++++++++++++ .github/ISSUE_TEMPLATE/api-improvement.md | 24 +++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 29 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 10 +++++++ .github/ISSUE_TEMPLATE/new-api-component.md | 15 +++++++++++ .github/ISSUE_TEMPLATE/other-enhancement.md | 22 ++++++++++++++++ 6 files changed, 125 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/api-deprecation.md create mode 100644 .github/ISSUE_TEMPLATE/api-improvement.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/new-api-component.md create mode 100644 .github/ISSUE_TEMPLATE/other-enhancement.md diff --git a/.github/ISSUE_TEMPLATE/api-deprecation.md b/.github/ISSUE_TEMPLATE/api-deprecation.md new file mode 100644 index 00000000..74e4c785 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/api-deprecation.md @@ -0,0 +1,25 @@ +--- +name: API deprecation +about: Suggest the deprecation of an API component defined by ArduinoCore-API. +title: "" +labels: enhancement +assignees: "" +--- + +### API component + + + +### Description + + + + +### Replacement API component + + + + +### Additional information + + diff --git a/.github/ISSUE_TEMPLATE/api-improvement.md b/.github/ISSUE_TEMPLATE/api-improvement.md new file mode 100644 index 00000000..1cfa43bb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/api-improvement.md @@ -0,0 +1,24 @@ +--- +name: API improvement +about: Suggest an improvement to an existing API component. +title: "" +labels: enhancement +assignees: "" +--- + +### API component + + + +### Description + + + +### Is this a breaking change? + + + + +### Additional information + + diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..cc410ae0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Report problems with the code in this repository. +title: "" +labels: bug +assignees: "" +--- + +### Description + + + +### Environment + +- Boards platform name: +- Boards platform version (as shown in Boards Manager): +- ArduinoCore-API version (if you manually installed it): + +### Current behavior + + + +### Expected behavior + + + +### Additional information + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..af023790 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,10 @@ +contact_links: + - name: Learn about the Arduino language + url: https://www.arduino.cc/reference/en + about: User documentation is available at the Arduino language reference. + - name: Support request + url: https://forum.arduino.cc/ + about: We can help you out on the Arduino Forum! + - name: Discuss ArduinoCore-API development + url: https://groups.google.com/a/arduino.cc/g/developers + about: Arduino Developers Mailing List diff --git a/.github/ISSUE_TEMPLATE/new-api-component.md b/.github/ISSUE_TEMPLATE/new-api-component.md new file mode 100644 index 00000000..15991f46 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-api-component.md @@ -0,0 +1,15 @@ +--- +name: New API component +about: Suggest the addition of a new API component to ArduinoCore-API. +title: "" +labels: enhancement +assignees: "" +--- + +### Description + + + +### Additional information + + diff --git a/.github/ISSUE_TEMPLATE/other-enhancement.md b/.github/ISSUE_TEMPLATE/other-enhancement.md new file mode 100644 index 00000000..c72cea49 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other-enhancement.md @@ -0,0 +1,22 @@ +--- +name: Other enhancement +about: + Suggest an improvement for this project that doesn't fit in the specific categories + above. +title: "" +labels: enhancement +assignees: "" +--- + +### Description + + + +### Is this a breaking change? + + + + +### Additional information + + From 032a0fc4772b3f43a5ad958b3de98a057b1b02a7 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Mon, 6 Mar 2023 13:05:20 +0100 Subject: [PATCH 02/61] Add HardwareCAN - a abstract base class for implementing CAN interfaces across Arduino cores. --- api/CanMsg.h | 97 ++++++++++++++++++++++++++++++++++++++++ api/CanMsgRingbuffer.cpp | 62 +++++++++++++++++++++++++ api/CanMsgRingbuffer.h | 60 +++++++++++++++++++++++++ api/HardwareCAN.h | 62 +++++++++++++++++++++++++ 4 files changed, 281 insertions(+) create mode 100644 api/CanMsg.h create mode 100644 api/CanMsgRingbuffer.cpp create mode 100644 api/CanMsgRingbuffer.h create mode 100644 api/HardwareCAN.h diff --git a/api/CanMsg.h b/api/CanMsg.h new file mode 100644 index 00000000..6021564a --- /dev/null +++ b/api/CanMsg.h @@ -0,0 +1,97 @@ +/* + * This file is free software; you can redistribute it and/or modify + * it under the terms of either the GNU General Public License version 2 + * or the GNU Lesser General Public License version 2.1, both as + * published by the Free Software Foundation. + */ + +#ifndef ARDUINOCORE_API_CAN_MSG_H_ +#define ARDUINOCORE_API_CAN_MSG_H_ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include +#include +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +namespace arduino +{ + +/************************************************************************************** + * CLASS DECLARATION + **************************************************************************************/ + +class CanMsg : public Printable +{ +public: + static size_t constexpr MAX_DATA_LENGTH = 8; + + CanMsg(uint32_t const can_id, uint8_t const can_data_len, uint8_t const * can_data_ptr) + : id{can_id} + , data_length{can_data_len} + , data{0} + { + memcpy(data, can_data_ptr, min(can_data_len, MAX_DATA_LENGTH)); + } + + CanMsg() : CanMsg(0, 0, nullptr) { } + + CanMsg(CanMsg const & other) + { + this->id = other.id; + this->data_length = other.data_length; + memcpy(this->data, other.data, this->data_length); + } + + virtual ~CanMsg() { } + + void operator = (CanMsg const & other) + { + if (this == &other) + return; + + this->id = other.id; + this->data_length = other.data_length; + memcpy(this->data, other.data, this->data_length); + } + + virtual size_t printTo(Print & p) const override + { + char buf[20] = {0}; + size_t len = 0; + + /* Print the header. */ + len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", id, data_length); + size_t n = p.write(buf, len); + + /* Print the data. */ + for (size_t d = 0; d < data_length; d++) + { + len = snprintf(buf, sizeof(buf), "%02X", data[d]); + n += p.write(buf, len); + } + + /* Wrap up. */ + return n; + } + + uint32_t id; + uint8_t data_length; + uint8_t data[MAX_DATA_LENGTH]; +}; + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +} /* arduino */ + +#endif /* ARDUINOCORE_API_CAN_MSG_H_ */ diff --git a/api/CanMsgRingbuffer.cpp b/api/CanMsgRingbuffer.cpp new file mode 100644 index 00000000..c358a10a --- /dev/null +++ b/api/CanMsgRingbuffer.cpp @@ -0,0 +1,62 @@ +/* + * This file is free software; you can redistribute it and/or modify + * it under the terms of either the GNU General Public License version 2 + * or the GNU Lesser General Public License version 2.1, both as + * published by the Free Software Foundation. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include "CanMsgRingbuffer.h" + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +namespace arduino +{ + +/************************************************************************************** + * CTOR/DTOR + **************************************************************************************/ + +CanMsgRingbuffer::CanMsgRingbuffer() +: _head{0} +, _tail{0} +, _num_elems{0} +{ +} + +/************************************************************************************** + * PUBLIC MEMBER FUNCTIONS + **************************************************************************************/ + +void CanMsgRingbuffer::enqueue(CanMsg const & msg) +{ + if (isFull()) + return; + + _buf[_head] = msg; + _head = next(_head); + _num_elems++; +} + +CanMsg CanMsgRingbuffer::dequeue() +{ + if (isEmpty()) + return CanMsg(); + + CanMsg const msg = _buf[_tail]; + _tail = next(_tail); + _num_elems--; + + return msg; +} + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +} /* arduino */ diff --git a/api/CanMsgRingbuffer.h b/api/CanMsgRingbuffer.h new file mode 100644 index 00000000..9218ef88 --- /dev/null +++ b/api/CanMsgRingbuffer.h @@ -0,0 +1,60 @@ +/* + * This file is free software; you can redistribute it and/or modify + * it under the terms of either the GNU General Public License version 2 + * or the GNU Lesser General Public License version 2.1, both as + * published by the Free Software Foundation. + */ + +#ifndef ARDUINOCORE_API_CAN_MSG_RING_BUFFER_H_ +#define ARDUINOCORE_API_CAN_MSG_RING_BUFFER_H_ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include "CanMsg.h" + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +namespace arduino +{ + +/************************************************************************************** + * CLASS DECLARATION + **************************************************************************************/ + +class CanMsgRingbuffer +{ +public: + static size_t constexpr RING_BUFFER_SIZE = 32U; + + CanMsgRingbuffer(); + + inline bool isFull() const { return (_num_elems == RING_BUFFER_SIZE); } + void enqueue(CanMsg const & msg); + + inline bool isEmpty() const { return (_num_elems == 0); } + CanMsg dequeue(); + + inline size_t available() const { return _num_elems; } + +private: + CanMsg _buf[RING_BUFFER_SIZE]; + volatile size_t _head; + volatile size_t _tail; + volatile size_t _num_elems; + + inline size_t next(size_t const idx) const { return ((idx + 1) % RING_BUFFER_SIZE); } +}; + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +} /* arduino */ + +#endif /* ARDUINOCORE_API_CAN_MSG_RING_BUFFER_H_ */ diff --git a/api/HardwareCAN.h b/api/HardwareCAN.h new file mode 100644 index 00000000..6dc87ebc --- /dev/null +++ b/api/HardwareCAN.h @@ -0,0 +1,62 @@ +/* + * This file is free software; you can redistribute it and/or modify + * it under the terms of either the GNU General Public License version 2 + * or the GNU Lesser General Public License version 2.1, both as + * published by the Free Software Foundation. + */ + +#ifndef ARDUINOCORE_API_HARDWARECAN_H +#define ARDUINOCORE_API_HARDWARECAN_H + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include "CanMsg.h" +#include "CanMsgRingbuffer.h" + +/************************************************************************************** + * TYPEDEF + **************************************************************************************/ + +enum class CanBitRate : int +{ + BR_125k = 125000, + BR_250k = 250000, + BR_500k = 500000, + BR_1000k = 1000000, +}; + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +namespace arduino +{ + +/************************************************************************************** + * CLASS DECLARATION + **************************************************************************************/ + +class HardwareCAN +{ +public: + virtual ~HardwareCAN() {} + + + virtual bool begin(CanBitRate const can_bitrate) = 0; + virtual void end() = 0; + + + virtual int write(CanMsg const &msg) = 0; + virtual size_t available() = 0; + virtual CanMsg read() = 0; +}; + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +} /* arduino */ + +#endif /* ARDUINOCORE_API_HARDWARECAN_H */ From c6371bcb51c08b153ec2fdd884a5a3647947b6c4 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Wed, 26 Apr 2023 12:22:39 +0200 Subject: [PATCH 03/61] Release version 1.4.1 CAN APIs added --- api/ArduinoAPI.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ArduinoAPI.h b/api/ArduinoAPI.h index edc04918..8464396c 100644 --- a/api/ArduinoAPI.h +++ b/api/ArduinoAPI.h @@ -20,8 +20,8 @@ #ifndef ARDUINO_API_H #define ARDUINO_API_H -// version 1.4.0 -#define ARDUINO_API_VERSION 10400 +// version 1.4.1 +#define ARDUINO_API_VERSION 10401 #include "Binary.h" From 1b7ef0de34097c1dd9637b9217bb727f11e55215 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 28 Apr 2023 10:29:11 +0200 Subject: [PATCH 04/61] IPAddress: add toString() method --- api/IPAddress.cpp | 27 +++++++++++++++++++++++++++ api/IPAddress.h | 3 +++ 2 files changed, 30 insertions(+) diff --git a/api/IPAddress.cpp b/api/IPAddress.cpp index 4b729319..1d775906 100644 --- a/api/IPAddress.cpp +++ b/api/IPAddress.cpp @@ -94,6 +94,33 @@ IPAddress::IPAddress(const char *address) fromString(address); } +String IPAddress::toString4() const +{ + char szRet[16]; + sprintf(szRet,"%u.%u.%u.%u", _address.bytes[IPADDRESS_V4_BYTES_INDEX], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 1], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 2], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 3]); + return String(szRet); +} + +String IPAddress::toString6() const +{ + char szRet[40]; + sprintf(szRet,"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3], + _address.bytes[4], _address.bytes[5], _address.bytes[6], _address.bytes[7], + _address.bytes[8], _address.bytes[9], _address.bytes[10], _address.bytes[11], + _address.bytes[12], _address.bytes[13], _address.bytes[14], _address.bytes[15]); + return String(szRet); +} + +String IPAddress::toString() const +{ + if (_type == IPv4) { + return toString4(); + } else { + return toString6(); + } +} + bool IPAddress::fromString(const char *address) { if (!fromString4(address)) { return fromString6(address); diff --git a/api/IPAddress.h b/api/IPAddress.h index 964faa67..28dde3be 100644 --- a/api/IPAddress.h +++ b/api/IPAddress.h @@ -96,6 +96,7 @@ class IPAddress : public Printable { IPAddress& operator=(const char *address); virtual size_t printTo(Print& p) const; + String toString() const; IPType type() { return _type; } @@ -110,6 +111,8 @@ class IPAddress : public Printable { protected: bool fromString4(const char *address); bool fromString6(const char *address); + String toString4() const; + String toString6() const; }; extern const IPAddress IN6ADDR_ANY; From 1a4a7f8bf3d01627b9359ce1f084a10a39d0aba0 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 28 Apr 2023 13:10:41 +0200 Subject: [PATCH 05/61] Add testcases for IPAddress::toString() --- test/CMakeLists.txt | 1 + test/src/IPAddress/test_toString.cpp | 37 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/src/IPAddress/test_toString.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0f6200b2..fce6e014 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,6 +29,7 @@ set(TEST_SRCS src/Common/test_map.cpp src/Common/test_max.cpp src/Common/test_min.cpp + src/IPAddress/test_toString.cpp src/IPAddress/test_fromString.cpp src/IPAddress/test_fromString6.cpp src/IPAddress/test_IPAddress.cpp diff --git a/test/src/IPAddress/test_toString.cpp b/test/src/IPAddress/test_toString.cpp new file mode 100644 index 00000000..a5a5f004 --- /dev/null +++ b/test/src/IPAddress/test_toString.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include +#include + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Extract valid string from IPv4address", "[IPAddress-toString-01]") +{ + arduino::IPAddress ip(129,168,1,2); + + REQUIRE(ip.toString().equals("129.168.1.2") == true); +} + +TEST_CASE ("Extract valid ipv6 string from IPv6address", "[IPAddress-toString-02]") +{ + arduino::IPAddress ip(0x20,0x01, 0xd,0xb8, 1,2, 3,4, 5,6, 7,8, 9,0xa, 0xb,0xc); + + REQUIRE(ip.toString().equals("2001:0db8:0102:0304:0506:0708:090a:0b0c") == true); +} + +TEST_CASE ("Extract 0.0.0.0 string from uninitialized IP address", "[IPAddress-toString-03]") +{ + arduino::IPAddress ip; + + REQUIRE(ip.toString().equals("0.0.0.0") == true); +} From ddca5c6a509e022d827821e1820b088822ff8dbb Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 15 May 2023 18:11:36 +0200 Subject: [PATCH 06/61] can api: fix for toolchain with limited c++ support --- api/CanMsg.h | 5 ++--- api/CanMsgRingbuffer.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index 6021564a..5b120344 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -12,9 +12,8 @@ * INCLUDE **************************************************************************************/ -#include -#include -#include +#include +#include #include diff --git a/api/CanMsgRingbuffer.h b/api/CanMsgRingbuffer.h index 9218ef88..461df450 100644 --- a/api/CanMsgRingbuffer.h +++ b/api/CanMsgRingbuffer.h @@ -12,7 +12,7 @@ * INCLUDE **************************************************************************************/ -#include +#include #include "CanMsg.h" From 5b9faf6095c0321b8d129a71c936d72e72716e71 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 15 May 2023 18:12:26 +0200 Subject: [PATCH 07/61] wcharacter: reimplement isblank, islower and ispunct --- api/WCharacter.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/WCharacter.h b/api/WCharacter.h index e3642ccb..d0508424 100644 --- a/api/WCharacter.h +++ b/api/WCharacter.h @@ -70,7 +70,7 @@ inline bool isAscii(int c) // Checks for a blank character, that is, a space or a tab. inline bool isWhitespace(int c) { - return ( isblank (c) == 0 ? false : true); + return ( c == '\t' || c == ' '); } @@ -98,7 +98,7 @@ inline bool isGraph(int c) // Checks for a lower-case character. inline bool isLowerCase(int c) { - return (islower (c) == 0 ? false : true); + return ( c >= 'a' && c <= 'z' ); } @@ -113,7 +113,7 @@ inline bool isPrintable(int c) // or an alphanumeric character. inline bool isPunct(int c) { - return ( ispunct (c) == 0 ? false : true); + return ( isPrintable(c) && !isSpace(c) && !isAlphaNumeric(c) ); } From 4db89597b09f6e72191ebaedb2ab110181982aa9 Mon Sep 17 00:00:00 2001 From: Pieter Pas Date: Mon, 31 Jul 2023 20:49:18 +0200 Subject: [PATCH 08/61] test: fix buffer overflow in String::getBytes test --- test/src/String/test_characterAccessFunc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/src/String/test_characterAccessFunc.cpp b/test/src/String/test_characterAccessFunc.cpp index 329cca43..d0f02383 100644 --- a/test/src/String/test_characterAccessFunc.cpp +++ b/test/src/String/test_characterAccessFunc.cpp @@ -45,10 +45,11 @@ TEST_CASE ("Testing String::getBytes(unsigned char, unsigned int, unsigned int)" WHEN("Valid operation") { arduino::String str("Hello"); - unsigned char buf[2]; + unsigned char buf[3]; str.getBytes(buf, 5, 3); REQUIRE(buf[0] == 'l'); REQUIRE(buf[1] == 'o'); + REQUIRE(buf[2] == '\0'); } } From 363c2c494d5d00e500e4ec6f82915230151f69ee Mon Sep 17 00:00:00 2001 From: Pieter Pas Date: Mon, 31 Jul 2023 20:51:39 +0200 Subject: [PATCH 09/61] test: fix CMAKE_{C,CXX}_FLAGS manipulation Use string concatenation instead of creating a list. --- test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fce6e014..2df2eacf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -121,8 +121,8 @@ add_compile_definitions(HOST) add_compile_options(-Wall -Wextra -Wpedantic -Werror) add_compile_options(-Wno-cast-function-type) -set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "--coverage") -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--coverage -Wno-deprecated-copy") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -Wno-deprecated-copy") ########################################################################## From 076d86fc58dc01f8b90d100a870df1d913e239ac Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 2 Aug 2023 07:40:35 +0200 Subject: [PATCH 10/61] Extend CanMsg to allow to distinguish between standard and extended IDs following a inspired approach. --- api/CanMsg.h | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index 5b120344..a95c1b08 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -31,7 +31,12 @@ namespace arduino class CanMsg : public Printable { public: - static size_t constexpr MAX_DATA_LENGTH = 8; + static size_t constexpr MAX_DATA_LENGTH = 8; + + static uint32_t constexpr CAN_EFF_FLAG = 0x80000000U; + static uint32_t constexpr CAN_SFF_MASK = 0x000007FFU; /* standard frame format (SFF) */ + static uint32_t constexpr CAN_EFF_MASK = 0x1FFFFFFFU; /* extended frame format (EFF) */ + CanMsg(uint32_t const can_id, uint8_t const can_data_len, uint8_t const * can_data_ptr) : id{can_id} @@ -68,7 +73,10 @@ class CanMsg : public Printable size_t len = 0; /* Print the header. */ - len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", id, data_length); + if (isStandardId()) + len = snprintf(buf, sizeof(buf), "[%03X] (%d) : ", id, data_length); + else + len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", id, data_length); size_t n = p.write(buf, len); /* Print the data. */ @@ -82,11 +90,45 @@ class CanMsg : public Printable return n; } + + uint32_t getStandardId() const { + return (id & CAN_SFF_MASK); + } + uint32_t getExtendedId() const { + return (id & CAN_EFF_MASK); + } + bool isStandardId() const { + return ((id & CAN_EFF_FLAG) == 0); + } + bool isExtendedId() const { + return ((id & CAN_EFF_FLAG) == CAN_EFF_FLAG); + } + + + /* + * CAN ID semantics (mirroring definition by linux/can.h): + * |- Bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) + * |- Bit 30 : reserved (future remote transmission request flag) + * |- Bit 29 : reserved (future error frame flag) + * |- Bit 0-28 : CAN identifier (11/29 bit) + */ uint32_t id; uint8_t data_length; uint8_t data[MAX_DATA_LENGTH]; }; +/************************************************************************************** + * FREE FUNCTIONS + **************************************************************************************/ + +static uint32_t CanStandardId(uint32_t const id) { + return (id & CanMsg::CAN_SFF_MASK); +} + +static uint32_t CanExtendedId(uint32_t const id) { + return (CanMsg::CAN_EFF_FLAG | (id & CanMsg::CAN_EFF_MASK)); +} + /************************************************************************************** * NAMESPACE **************************************************************************************/ From 36cc4b16cd02d70a464980265b6a9afb4c11ed98 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 2 Aug 2023 08:35:15 +0200 Subject: [PATCH 11/61] Obtain the actual printable ID via getStandardId(), getExtendedId() in order to eliminate the 3 MSBits encoded status flags. --- api/CanMsg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index a95c1b08..653b3c9f 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -74,9 +74,9 @@ class CanMsg : public Printable /* Print the header. */ if (isStandardId()) - len = snprintf(buf, sizeof(buf), "[%03X] (%d) : ", id, data_length); + len = snprintf(buf, sizeof(buf), "[%03X] (%d) : ", getStandardId(), data_length); else - len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", id, data_length); + len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", getExtendedId(), data_length); size_t n = p.write(buf, len); /* Print the data. */ From 27a7b079f6a1615e66b8d579a961927e8a773edc Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 2 Aug 2023 13:37:02 +0200 Subject: [PATCH 12/61] Implementing test code for "CanStandardId", "CanExtendedId", "isStandardId", "isExtendedId". --- test/CMakeLists.txt | 5 ++++ test/src/CanMsg/test_CanExtendedId.cpp | 41 ++++++++++++++++++++++++++ test/src/CanMsg/test_CanStandardId.cpp | 40 +++++++++++++++++++++++++ test/src/CanMsg/test_isExtendedId.cpp | 33 +++++++++++++++++++++ test/src/CanMsg/test_isStandardId.cpp | 33 +++++++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 test/src/CanMsg/test_CanExtendedId.cpp create mode 100644 test/src/CanMsg/test_CanStandardId.cpp create mode 100644 test/src/CanMsg/test_isExtendedId.cpp create mode 100644 test/src/CanMsg/test_isStandardId.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2df2eacf..c834fd14 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,6 +25,10 @@ set(TEST_TARGET ${CMAKE_PROJECT_NAME}) ########################################################################## set(TEST_SRCS + src/CanMsg/test_CanExtendedId.cpp + src/CanMsg/test_CanStandardId.cpp + src/CanMsg/test_isExtendedId.cpp + src/CanMsg/test_isStandardId.cpp src/Common/test_makeWord.cpp src/Common/test_map.cpp src/Common/test_max.cpp @@ -95,6 +99,7 @@ set(TEST_SRCS ) set(TEST_DUT_SRCS + ../api/CanMsg.cpp ../api/Common.cpp ../api/IPAddress.cpp ../api/String.cpp diff --git a/test/src/CanMsg/test_CanExtendedId.cpp b/test/src/CanMsg/test_CanExtendedId.cpp new file mode 100644 index 00000000..72f8ece5 --- /dev/null +++ b/test/src/CanMsg/test_CanExtendedId.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Verify correct conversion to 29-Bit CAN ID for lowest valid 29-Bit CAN ID", "[CanMsg-CanExtendedId-01]") +{ + REQUIRE(CanExtendedId(0) == (CanMsg::CAN_EFF_FLAG | 0U)); +} + +TEST_CASE ("Verify correct conversion to 29-Bit CAN ID for highest valid 29-Bit CAN ID", "[CanMsg-CanExtendedId-02]") +{ + REQUIRE(CanExtendedId(0x1FFFFFFFU) == (CanMsg::CAN_EFF_FLAG | 0x1FFFFFFFU)); +} + +TEST_CASE ("Verify capping of CAN IDs exceeding 29-Bit CAN ID range", "[CanMsg-CanExtendedId-03]") +{ + REQUIRE(CanExtendedId(0x2FFFFFFFU) == (CanMsg::CAN_EFF_FLAG | 0x0FFFFFFFU)); + REQUIRE(CanExtendedId(0x3FFFFFFFU) == (CanMsg::CAN_EFF_FLAG | 0x1FFFFFFFU)); + REQUIRE(CanExtendedId(0x4FFFFFFFU) == (CanMsg::CAN_EFF_FLAG | 0x0FFFFFFFU)); + REQUIRE(CanExtendedId(0x5FFFFFFFU) == (CanMsg::CAN_EFF_FLAG | 0x1FFFFFFFU)); + /* ... */ + REQUIRE(CanExtendedId(0xFFFFFFFFU) == (CanMsg::CAN_EFF_FLAG | 0x1FFFFFFFU)); +} diff --git a/test/src/CanMsg/test_CanStandardId.cpp b/test/src/CanMsg/test_CanStandardId.cpp new file mode 100644 index 00000000..02496241 --- /dev/null +++ b/test/src/CanMsg/test_CanStandardId.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Verify correct conversion to 11-Bit CAN ID for lowest valid 11-Bit CAN ID", "[CanMsg-CanStandardId-01]") +{ + REQUIRE(CanStandardId(0) == 0U); +} + +TEST_CASE ("Verify correct conversion to 11-Bit CAN ID for highest valid 11-Bit CAN ID", "[CanMsg-CanStandardId-02]") +{ + REQUIRE(CanStandardId(0x7FF) == 0x7FF); +} + +TEST_CASE ("Verify capping of CAN IDs exceeding 11-Bit CAN ID range", "[CanMsg-CanStandardId-03]") +{ + REQUIRE(CanStandardId(0x800U) == 0x000U); + REQUIRE(CanStandardId(0x801U) == 0x001U); + REQUIRE(CanStandardId(0x8FFU) == 0x0FFU); + REQUIRE(CanStandardId(0x1FFFFFFFU) == 0x7FFU); + REQUIRE(CanStandardId(0xFFFFFFFFU) == 0x7FFU); +} diff --git a/test/src/CanMsg/test_isExtendedId.cpp b/test/src/CanMsg/test_isExtendedId.cpp new file mode 100644 index 00000000..3a12ab8f --- /dev/null +++ b/test/src/CanMsg/test_isExtendedId.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("\"isExtendedId\" should return true for extended CAN ID", "[CanMsg-isExtendedId-01]") +{ + CanMsg const msg_ext_id(CanExtendedId(0x020), 0, nullptr); + REQUIRE(msg_ext_id.isExtendedId() == true); +} + +TEST_CASE ("\"isExtendedId\" should return false for standard CAN ID", "[CanMsg-isExtendedId-02]") +{ + CanMsg const msg_std_id(CanStandardId(0x020), 0, nullptr); + REQUIRE(msg_std_id.isExtendedId() == false); +} diff --git a/test/src/CanMsg/test_isStandardId.cpp b/test/src/CanMsg/test_isStandardId.cpp new file mode 100644 index 00000000..718d2535 --- /dev/null +++ b/test/src/CanMsg/test_isStandardId.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("\"isStandardId\" should return true for standard CAN ID", "[CanMsg-isStandardId-01]") +{ + CanMsg const msg_std_id(CanStandardId(0x020), 0, nullptr); + REQUIRE(msg_std_id.isStandardId() == true); +} + +TEST_CASE ("\"isStandardId\" should return false for extended CAN ID", "[CanMsg-isStandardId-02]") +{ + CanMsg const msg_ext_id(CanExtendedId(0x020), 0, nullptr); + REQUIRE(msg_ext_id.isStandardId() == false); +} From 70d393933c3dc3ceab10deea7759d2ef06d4a07f Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 2 Aug 2023 13:37:57 +0200 Subject: [PATCH 13/61] Replace broad include file with only the required include files, inline functions to prevent linker errors, and define static constants so that the compiler can place them in memory. All of those changes broaden adoption. --- api/CanMsg.cpp | 34 ++++++++++++++++++++++++++++++++++ api/CanMsg.h | 14 ++++++++------ 2 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 api/CanMsg.cpp diff --git a/api/CanMsg.cpp b/api/CanMsg.cpp new file mode 100644 index 00000000..a87900ca --- /dev/null +++ b/api/CanMsg.cpp @@ -0,0 +1,34 @@ +/* + * This file is free software; you can redistribute it and/or modify + * it under the terms of either the GNU General Public License version 2 + * or the GNU Lesser General Public License version 2.1, both as + * published by the Free Software Foundation. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include "CanMsg.h" + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +namespace arduino +{ + +/************************************************************************************** + * STATIC CONST DEFINITION + **************************************************************************************/ + +size_t const CanMsg::MAX_DATA_LENGTH; +uint32_t const CanMsg::CAN_EFF_FLAG; +uint32_t const CanMsg::CAN_SFF_MASK; +uint32_t const CanMsg::CAN_EFF_MASK; + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +} /* arduino */ diff --git a/api/CanMsg.h b/api/CanMsg.h index 653b3c9f..4025c177 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -15,7 +15,9 @@ #include #include -#include +#include "Print.h" +#include "Printable.h" +#include "Common.h" /************************************************************************************** * NAMESPACE @@ -112,20 +114,20 @@ class CanMsg : public Printable * |- Bit 29 : reserved (future error frame flag) * |- Bit 0-28 : CAN identifier (11/29 bit) */ - uint32_t id; - uint8_t data_length; - uint8_t data[MAX_DATA_LENGTH]; + private: uint32_t id; + public: uint8_t data_length; + public: uint8_t data[MAX_DATA_LENGTH]; }; /************************************************************************************** * FREE FUNCTIONS **************************************************************************************/ -static uint32_t CanStandardId(uint32_t const id) { +inline uint32_t CanStandardId(uint32_t const id) { return (id & CanMsg::CAN_SFF_MASK); } -static uint32_t CanExtendedId(uint32_t const id) { +inline uint32_t CanExtendedId(uint32_t const id) { return (CanMsg::CAN_EFF_FLAG | (id & CanMsg::CAN_EFF_MASK)); } From bba303d2e6016e68d214696b50fed951e563dd35 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 08:18:46 +0200 Subject: [PATCH 14/61] Adding test code for CanMsg::CanMsg. --- test/CMakeLists.txt | 1 + test/src/CanMsg/test_CanMsg.cpp | 52 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/src/CanMsg/test_CanMsg.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c834fd14..6f1819cb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,6 +25,7 @@ set(TEST_TARGET ${CMAKE_PROJECT_NAME}) ########################################################################## set(TEST_SRCS + src/CanMsg/test_CanMsg.cpp src/CanMsg/test_CanExtendedId.cpp src/CanMsg/test_CanStandardId.cpp src/CanMsg/test_isExtendedId.cpp diff --git a/test/src/CanMsg/test_CanMsg.cpp b/test/src/CanMsg/test_CanMsg.cpp new file mode 100644 index 00000000..09502df8 --- /dev/null +++ b/test/src/CanMsg/test_CanMsg.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Test constructor with no data (data length = 0)", "[CanMsg-CanMsg-01]") +{ + CanMsg const msg(CanStandardId(0x20), 0, nullptr); + + REQUIRE(msg.data_length == 0); + for (size_t i = 0; i < CanMsg::MAX_DATA_LENGTH; i++) + REQUIRE(msg.data[i] == 0); +} + +TEST_CASE ("Test constructor with data (data length < CanMsg::MAX_DATA_LENGTH)", "[CanMsg-CanMsg-02]") +{ + uint8_t const msg_data[4] = {0xDE, 0xAD, 0xC0, 0xDE}; + + CanMsg const msg(CanStandardId(0x20), sizeof(msg_data), msg_data); + + REQUIRE(msg.data_length == 4); + for (size_t i = 0; i < msg.data_length; i++) + REQUIRE(msg.data[i] == msg_data[i]); +} + +TEST_CASE ("Test constructor with data (data length > CanMsg::MAX_DATA_LENGTH)", "[CanMsg-CanMsg-03]") +{ + uint8_t const msg_data[12] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + + CanMsg const msg(CanStandardId(0x20), sizeof(msg_data), msg_data); + + REQUIRE(msg.data_length == 8); + for (size_t i = 0; i < msg.data_length; i++) + REQUIRE(msg.data[i] == msg_data[i]); +} From 39aa6841f5bb5a8e7de4220e1c8fbb7a6c551974 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 08:20:45 +0200 Subject: [PATCH 15/61] Fixing bug leading to incorrect length stored when frame lenght exceeds max data lenght. --- api/CanMsg.cpp | 2 +- api/CanMsg.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/CanMsg.cpp b/api/CanMsg.cpp index a87900ca..1137f066 100644 --- a/api/CanMsg.cpp +++ b/api/CanMsg.cpp @@ -22,7 +22,7 @@ namespace arduino * STATIC CONST DEFINITION **************************************************************************************/ -size_t const CanMsg::MAX_DATA_LENGTH; +uint8_t const CanMsg::MAX_DATA_LENGTH; uint32_t const CanMsg::CAN_EFF_FLAG; uint32_t const CanMsg::CAN_SFF_MASK; uint32_t const CanMsg::CAN_EFF_MASK; diff --git a/api/CanMsg.h b/api/CanMsg.h index 4025c177..2b00871d 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -33,7 +33,7 @@ namespace arduino class CanMsg : public Printable { public: - static size_t constexpr MAX_DATA_LENGTH = 8; + static uint8_t constexpr MAX_DATA_LENGTH = 8; static uint32_t constexpr CAN_EFF_FLAG = 0x80000000U; static uint32_t constexpr CAN_SFF_MASK = 0x000007FFU; /* standard frame format (SFF) */ @@ -42,10 +42,10 @@ class CanMsg : public Printable CanMsg(uint32_t const can_id, uint8_t const can_data_len, uint8_t const * can_data_ptr) : id{can_id} - , data_length{can_data_len} + , data_length{min(can_data_len, MAX_DATA_LENGTH)} , data{0} { - memcpy(data, can_data_ptr, min(can_data_len, MAX_DATA_LENGTH)); + memcpy(data, can_data_ptr, data_length); } CanMsg() : CanMsg(0, 0, nullptr) { } From 16c74c18645be24f01f81227fd228d6f4fed4c5f Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 13:19:17 +0200 Subject: [PATCH 16/61] Test CanMsg copy constructor. --- test/CMakeLists.txt | 1 + test/src/CanMsg/test_CanMsg_CopyCtor.cpp | 38 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 test/src/CanMsg/test_CanMsg_CopyCtor.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6f1819cb..d701e588 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,6 +26,7 @@ set(TEST_TARGET ${CMAKE_PROJECT_NAME}) set(TEST_SRCS src/CanMsg/test_CanMsg.cpp + src/CanMsg/test_CanMsg_CopyCtor.cpp src/CanMsg/test_CanExtendedId.cpp src/CanMsg/test_CanStandardId.cpp src/CanMsg/test_isExtendedId.cpp diff --git a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp new file mode 100644 index 00000000..a1442c09 --- /dev/null +++ b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Test copy constructor", "[CanMsg-CopyCtor-01]") +{ + uint8_t const msg_data[4] = {0xDE, 0xAD, 0xC0, 0xDE}; + + CanMsg const msg_1(CanStandardId(0x20), sizeof(msg_data), msg_data); + CanMsg const msg_2(msg_1); + + REQUIRE(msg_1.data_length == msg_2.data_length); + + for (size_t i = 0; i < msg_1.data_length; i++) + { + REQUIRE(msg_1.data[i] == msg_data[i]); + REQUIRE(msg_2.data[i] == msg_data[i]); + } + +} From ed1c507270270ce3cf2c0d726c1b8dd8367cdac1 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 13:29:18 +0200 Subject: [PATCH 17/61] Completing test code for all APIs of CanMsg. --- test/CMakeLists.txt | 2 + test/src/CanMsg/test_CanMsg_CopyCtor.cpp | 1 - test/src/CanMsg/test_operator_assignment.cpp | 39 +++++++++++++++++ test/src/CanMsg/test_printTo.cpp | 44 ++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 test/src/CanMsg/test_operator_assignment.cpp create mode 100644 test/src/CanMsg/test_printTo.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d701e588..e1ca18d2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -31,6 +31,8 @@ set(TEST_SRCS src/CanMsg/test_CanStandardId.cpp src/CanMsg/test_isExtendedId.cpp src/CanMsg/test_isStandardId.cpp + src/CanMsg/test_operator_assignment.cpp + src/CanMsg/test_printTo.cpp src/Common/test_makeWord.cpp src/Common/test_map.cpp src/Common/test_max.cpp diff --git a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp index a1442c09..b303369a 100644 --- a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp +++ b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp @@ -34,5 +34,4 @@ TEST_CASE ("Test copy constructor", "[CanMsg-CopyCtor-01]") REQUIRE(msg_1.data[i] == msg_data[i]); REQUIRE(msg_2.data[i] == msg_data[i]); } - } diff --git a/test/src/CanMsg/test_operator_assignment.cpp b/test/src/CanMsg/test_operator_assignment.cpp new file mode 100644 index 00000000..ae2d2ecb --- /dev/null +++ b/test/src/CanMsg/test_operator_assignment.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Testing CanMsg::operator = (CanMsg const &)", "[CanMsg-Operator-=-1]") +{ + uint8_t const msg_data[4] = {0xDE, 0xAD, 0xC0, 0xDE}; + + CanMsg const msg_1(CanStandardId(0x20), sizeof(msg_data), msg_data); + CanMsg msg_2(CanStandardId(0x21), 0, nullptr); + + msg_2 = msg_1; + + REQUIRE(msg_1.data_length == msg_2.data_length); + + for (size_t i = 0; i < msg_1.data_length; i++) + { + REQUIRE(msg_1.data[i] == msg_data[i]); + REQUIRE(msg_2.data[i] == msg_data[i]); + } +} diff --git a/test/src/CanMsg/test_printTo.cpp b/test/src/CanMsg/test_printTo.cpp new file mode 100644 index 00000000..d55973ac --- /dev/null +++ b/test/src/CanMsg/test_printTo.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include +#include + +/************************************************************************************** + * NAMESPACE + **************************************************************************************/ + +using namespace arduino; + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Print CAN frame with standard ID", "[CanMsg-printTo-1]") +{ + uint8_t const std_msg_data[] = {0xBE, 0xEF}; + CanMsg const std_msg(CanStandardId(0x20), sizeof(std_msg_data), std_msg_data); + + PrintMock mock; + mock.print(std_msg); + + REQUIRE(mock._str == "[020] (2) : BEEF"); +} + +TEST_CASE ("Print CAN frame with extended ID", "[CanMsg-printTo-1]") +{ + uint8_t const ext_msg_data[] = {0xDE, 0xAD, 0xC0, 0xDE}; + CanMsg const ext_msg(CanExtendedId(0x20), sizeof(ext_msg_data), ext_msg_data); + + PrintMock mock; + mock.print(ext_msg); + + REQUIRE(mock._str == "[00000020] (4) : DEADC0DE"); +} From 437020eb4bf517413afdd89192758b4a86be8742 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 13:29:55 +0200 Subject: [PATCH 18/61] Fix wrong test case number. --- test/src/CanMsg/test_printTo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/CanMsg/test_printTo.cpp b/test/src/CanMsg/test_printTo.cpp index d55973ac..dd1fb4b8 100644 --- a/test/src/CanMsg/test_printTo.cpp +++ b/test/src/CanMsg/test_printTo.cpp @@ -32,7 +32,7 @@ TEST_CASE ("Print CAN frame with standard ID", "[CanMsg-printTo-1]") REQUIRE(mock._str == "[020] (2) : BEEF"); } -TEST_CASE ("Print CAN frame with extended ID", "[CanMsg-printTo-1]") +TEST_CASE ("Print CAN frame with extended ID", "[CanMsg-printTo-2]") { uint8_t const ext_msg_data[] = {0xDE, 0xAD, 0xC0, 0xDE}; CanMsg const ext_msg(CanExtendedId(0x20), sizeof(ext_msg_data), ext_msg_data); From ba86aefb521d104cbf69cb1a21373e6821e46631 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 13:35:32 +0200 Subject: [PATCH 19/61] Restore full public access to "id", even if that enables some foot-shooting. --- api/CanMsg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index 2b00871d..b561bf97 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -114,9 +114,9 @@ class CanMsg : public Printable * |- Bit 29 : reserved (future error frame flag) * |- Bit 0-28 : CAN identifier (11/29 bit) */ - private: uint32_t id; - public: uint8_t data_length; - public: uint8_t data[MAX_DATA_LENGTH]; + uint32_t id; + uint8_t data_length; + uint8_t data[MAX_DATA_LENGTH]; }; /************************************************************************************** From ab4a66c65310525fe2eab699cce460ba31fb4bf4 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 13:38:31 +0200 Subject: [PATCH 20/61] Encode expectations for value of "id" in unit test. --- test/src/CanMsg/test_CanMsg.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/src/CanMsg/test_CanMsg.cpp b/test/src/CanMsg/test_CanMsg.cpp index 09502df8..14b8a76a 100644 --- a/test/src/CanMsg/test_CanMsg.cpp +++ b/test/src/CanMsg/test_CanMsg.cpp @@ -50,3 +50,17 @@ TEST_CASE ("Test constructor with data (data length > CanMsg::MAX_DATA_LENGTH)", for (size_t i = 0; i < msg.data_length; i++) REQUIRE(msg.data[i] == msg_data[i]); } + +TEST_CASE ("Test constructor constructing a CAN frame with standard ID", "[CanMsg-CanMsg-04]") +{ + CanMsg const msg(CanStandardId(0x20), 0, nullptr); + + REQUIRE(msg.id == 0x20); +} + +TEST_CASE ("Test constructor constructing a CAN frame with extended ID", "[CanMsg-CanMsg-05]") +{ + CanMsg const msg(CanExtendedId(0x20), 0, nullptr); + + REQUIRE(msg.id == (CanMsg::CAN_EFF_FLAG | 0x20)); +} From b997cbfd07c99dd66f3f9094cb2c97dc7b8ff8ea Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 3 Aug 2023 13:39:46 +0200 Subject: [PATCH 21/61] Ignore visual studio code and clion artifacts. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..93c700e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode/ +.idea/ From e09108034ffb002f366d79646a67607e66fadf45 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 10 Aug 2023 07:36:00 +0200 Subject: [PATCH 22/61] Fix copy-assignment operator. --- api/CanMsg.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index b561bf97..fe0b920c 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -59,14 +59,15 @@ class CanMsg : public Printable virtual ~CanMsg() { } - void operator = (CanMsg const & other) + CanMsg & operator = (CanMsg const & other) { - if (this == &other) - return; - - this->id = other.id; - this->data_length = other.data_length; - memcpy(this->data, other.data, this->data_length); + if (this != &other) + { + this->id = other.id; + this->data_length = other.data_length; + memcpy(this->data, other.data, this->data_length); + } + return (*this); } virtual size_t printTo(Print & p) const override From 669bf386f62e9c3634b34ce871dd22891b823347 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Mon, 21 Aug 2023 14:45:52 +0100 Subject: [PATCH 23/61] Fix volatile errors when compiling for C++23 --- api/RingBuffer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/RingBuffer.h b/api/RingBuffer.h index 833350d1..8665cf6a 100644 --- a/api/RingBuffer.h +++ b/api/RingBuffer.h @@ -77,7 +77,7 @@ void RingBufferN::store_char( uint8_t c ) { _aucBuffer[_iHead] = c ; _iHead = nextIndex(_iHead); - _numElems++; + _numElems = _numElems + 1; } } @@ -97,7 +97,7 @@ int RingBufferN::read_char() uint8_t value = _aucBuffer[_iTail]; _iTail = nextIndex(_iTail); - _numElems--; + _numElems = _numElems - 1; return value; } @@ -138,4 +138,4 @@ bool RingBufferN::isFull() } #endif /* _RING_BUFFER_ */ -#endif /* __cplusplus */ \ No newline at end of file +#endif /* __cplusplus */ From a5b8e43c9cefd0f3f1d0485ee4c5a8119460770d Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Fri, 25 Aug 2023 10:47:33 -0700 Subject: [PATCH 24/61] Fix format specifier for printing CAN message ID in CanMsg.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regarding the X format specifier: C standard §7.21.6.1: "The unsigned int argument is converted to ..." On some platforms (e.g. mbed_nano), uint32_t, which is what's being printed here, is an unsigned long int, so this code causes a compiler warning. The fix is to use the format specifiers from §7.8.1, specifically PRIX32. --- api/CanMsg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index 5b120344..522e6541 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -12,7 +12,7 @@ * INCLUDE **************************************************************************************/ -#include +#include #include #include @@ -68,7 +68,7 @@ class CanMsg : public Printable size_t len = 0; /* Print the header. */ - len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", id, data_length); + len = snprintf(buf, sizeof(buf), "[%08" PRIX32 "] (%d) : ", id, data_length); size_t n = p.write(buf, len); /* Print the data. */ From f6764f41fe3b9cbcb94b042944adefa17af0de2f Mon Sep 17 00:00:00 2001 From: PiotrekB416 Date: Wed, 30 Aug 2023 16:39:11 +0200 Subject: [PATCH 25/61] Fix String::replace replace multiple occurrences of longer String by shorter one --- api/String.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/String.cpp b/api/String.cpp index 0a5c11fe..7e76a510 100644 --- a/api/String.cpp +++ b/api/String.cpp @@ -234,10 +234,10 @@ void String::move(String &rhs) String & String::operator = (const String &rhs) { if (this == &rhs) return *this; - + if (rhs.buffer) copy(rhs.buffer, rhs.len); else invalidate(); - + return *this; } @@ -253,7 +253,7 @@ String & String::operator = (const char *cstr) { if (cstr) copy(cstr, strlen(cstr)); else invalidate(); - + return *this; } @@ -484,7 +484,7 @@ bool String::equalsIgnoreCase( const String &s2 ) const const char *p2 = s2.buffer; while (*p1) { if (tolower(*p1++) != tolower(*p2++)) return false; - } + } return true; } @@ -515,7 +515,7 @@ char String::charAt(unsigned int loc) const return operator[](loc); } -void String::setCharAt(unsigned int loc, char c) +void String::setCharAt(unsigned int loc, char c) { if (loc < len) buffer[loc] = c; } @@ -652,9 +652,9 @@ void String::replace(const String& find, const String& replace) } } else if (diff < 0) { unsigned int size = len; // compute size needed for result + diff = 0 - diff; while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { readFrom = foundAt + find.len; - diff = 0 - diff; size -= diff; } if (size == len) return; From f782ba4bd546659f9c60ee448ea643e180535910 Mon Sep 17 00:00:00 2001 From: PiotrekB416 Date: Wed, 30 Aug 2023 16:42:00 +0200 Subject: [PATCH 26/61] Add tests --- test/src/String/test_replace.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/src/String/test_replace.cpp b/test/src/String/test_replace.cpp index 5d46fafb..d4f28bf5 100644 --- a/test/src/String/test_replace.cpp +++ b/test/src/String/test_replace.cpp @@ -66,3 +66,24 @@ TEST_CASE ("Testing String::replace(String, String) substr 'find' smaller than ' str.replace(arduino::String("ll"), arduino::String("111")); REQUIRE(str == "He111o Arduino!"); } + +TEST_CASE ("Testing String::replace(String, String) substr 'find' smaller than 'replace' multiple occurencies", "[String-replace-08]") +{ + arduino::String str("Hello Arduino! Hello, Hello, Hello"); + str.replace(arduino::String("ll"), arduino::String("lll")); + REQUIRE(str == "Helllo Arduino! Helllo, Helllo, Helllo"); +} + +TEST_CASE ("Testing String::replace(String, String) substr 'find' same length as 'replace' multiple occurencies", "[String-replace-09]") +{ + arduino::String str("Hello Arduino! Hello, Hello, Hello"); + str.replace(arduino::String("ll"), arduino::String("11")); + REQUIRE(str == "He11o Arduino! He11o, He11o, He11o"); +} + +TEST_CASE ("Testing String::replace(String, String) substr 'find' larger than 'replace' multiple occurencies", "[String-replace-10]") +{ + arduino::String str("Helllo Arduino! Helllo, Helllo, Helllo"); + str.replace(arduino::String("lll"), arduino::String("ll")); + REQUIRE(str == "Hello Arduino! Hello, Hello, Hello"); +} From 12fb6ba05e44385052a65de88f79003467bc8ce5 Mon Sep 17 00:00:00 2001 From: Piotr Bartoszewicz <89194651+PiotrekB416@users.noreply.github.com> Date: Wed, 30 Aug 2023 23:15:05 +0200 Subject: [PATCH 27/61] Update api/String.cpp Co-authored-by: per1234 --- api/String.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/String.cpp b/api/String.cpp index 7e76a510..69125aa2 100644 --- a/api/String.cpp +++ b/api/String.cpp @@ -652,7 +652,7 @@ void String::replace(const String& find, const String& replace) } } else if (diff < 0) { unsigned int size = len; // compute size needed for result - diff = 0 - diff; + diff = 0 - diff; while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { readFrom = foundAt + find.len; size -= diff; From b052976fafa1bf4e4840a23ca5670b2608c02eb7 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 4 Sep 2023 15:09:25 +0200 Subject: [PATCH 28/61] Release version 1.4.2 --- api/ArduinoAPI.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ArduinoAPI.h b/api/ArduinoAPI.h index 8464396c..c1ce5d2d 100644 --- a/api/ArduinoAPI.h +++ b/api/ArduinoAPI.h @@ -20,8 +20,8 @@ #ifndef ARDUINO_API_H #define ARDUINO_API_H -// version 1.4.1 -#define ARDUINO_API_VERSION 10401 +// version 1.4.2 +#define ARDUINO_API_VERSION 10402 #include "Binary.h" From b2e375aad4a1ed5aed05bf11cdb7ff7d975f11d0 Mon Sep 17 00:00:00 2001 From: Umberto Baldi <34278123+umbynos@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:16:25 +0200 Subject: [PATCH 29/61] Bump codecov-action to v3, and use token --- .github/workflows/unit-tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f72d58b1..55d5b650 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -38,8 +38,9 @@ jobs: coverage-data-path: ${{ env.COVERAGE_DATA_PATH }} # See: https://github.com/codecov/codecov-action/blob/master/README.md - - name: Upload coverage report to Codecov - uses: codecov/codecov-action@v1 + - name: Code coverage + uses: codecov/codecov-action@v3 with: - file: ${{ env.COVERAGE_DATA_PATH }} + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ env.COVERAGE_DATA_PATH }} fail_ci_if_error: true From 8ce59d204de0644e5804547dce83fab9e95ec247 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Mon, 4 Sep 2023 17:17:39 +0200 Subject: [PATCH 30/61] Add a test case demonstrating the issue when trying to print a zero value for uint64_t. --- test/src/Print/test_print.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/src/Print/test_print.cpp b/test/src/Print/test_print.cpp index 92e9c083..ac731a89 100644 --- a/test/src/Print/test_print.cpp +++ b/test/src/Print/test_print.cpp @@ -110,12 +110,24 @@ TEST_CASE ("Print::print(unsigned long long, int = DEC|HEX|OCT|BIN)", "[Print-pr { PrintMock mock; - unsigned long long const val = 17; + GIVEN("a value of zero ...") + { + unsigned long long const val = 0; - WHEN("DEC") { mock.print(val, DEC); REQUIRE(mock._str == "17"); } - WHEN("HEX") { mock.print(val, HEX); REQUIRE(mock._str == "11"); } - WHEN("OCT") { mock.print(val, OCT); REQUIRE(mock._str == "21"); } - WHEN("BIN") { mock.print(val, BIN); REQUIRE(mock._str == "10001"); } + WHEN("DEC") { mock.print(val, DEC); REQUIRE(mock._str == "0"); } + WHEN("HEX") { mock.print(val, HEX); REQUIRE(mock._str == "0"); } + WHEN("OCT") { mock.print(val, OCT); REQUIRE(mock._str == "0"); } + WHEN("BIN") { mock.print(val, BIN); REQUIRE(mock._str == "0"); } + } + GIVEN("a non-zero value ...") + { + unsigned long long const val = 17; + + WHEN("DEC") { mock.print(val, DEC); REQUIRE(mock._str == "17"); } + WHEN("HEX") { mock.print(val, HEX); REQUIRE(mock._str == "11"); } + WHEN("OCT") { mock.print(val, OCT); REQUIRE(mock._str == "21"); } + WHEN("BIN") { mock.print(val, BIN); REQUIRE(mock._str == "10001"); } + } } TEST_CASE ("Print::print(double, int = 2)", "[Print-print-10]") From 754aa9b1a65f15c190d49b2478b95ccbe55b7f7a Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 3 Sep 2023 13:18:47 -0700 Subject: [PATCH 31/61] Fix Print::print(0ULL) Fixes #1691 To be removed once upstream bug is fixed and core-api imported: https://github.com/arduino/ArduinoCore-API/issues/178 --- api/Print.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/Print.cpp b/api/Print.cpp index 8c3e1930..f1e82469 100644 --- a/api/Print.cpp +++ b/api/Print.cpp @@ -287,6 +287,12 @@ size_t Print::printULLNumber(unsigned long long n64, uint8_t base) uint8_t i = 0; uint8_t innerLoops = 0; + // Special case workaround https://github.com/arduino/ArduinoCore-API/issues/178 + if (n64 == 0) { + write('0'); + return 1; + } + // prevent crash if called with base == 1 if (base < 2) base = 10; From 296baa093f150524c3a236f6865d69d617db1cf0 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 7 Sep 2023 12:32:15 +0100 Subject: [PATCH 32/61] Do not rely on the actual value returned from strcmp in tests, only the on sign. --- test/src/String/test_compareTo.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/src/String/test_compareTo.cpp b/test/src/String/test_compareTo.cpp index 9aef1ee7..714d169a 100644 --- a/test/src/String/test_compareTo.cpp +++ b/test/src/String/test_compareTo.cpp @@ -27,13 +27,13 @@ TEST_CASE ("Testing String::compareTo(const String &)", "[String-compareTo-01]") WHEN ("str2 is empty") { arduino::String str1("Hello"), str2; - REQUIRE(str1.compareTo(str2) == strcmp(str1.c_str(), str2.c_str())); + REQUIRE(str1.compareTo(str2) > 0); } WHEN ("str1 is empty") { arduino::String str1, str2("Hello"); - REQUIRE(str1.compareTo(str2) == strcmp(str1.c_str(), str2.c_str())); + REQUIRE(str1.compareTo(str2) < 0); } } @@ -47,14 +47,14 @@ TEST_CASE ("Testing String::compareTo(const char *)", "[String-compareTo-02]") WHEN ("Passed string is empty") { - arduino::String str1("Hello"), str2(""); - REQUIRE(str1.compareTo("") == strcmp(str1.c_str(), str2.c_str())); + arduino::String str("Hello"); + REQUIRE(str.compareTo("") > 0); } WHEN ("Passed string is compared with empty string") { - arduino::String str1, str2("Hello"); - REQUIRE(str1.compareTo("Hello") == strcmp(str1.c_str(), str2.c_str())); + arduino::String str; + REQUIRE(str.compareTo("") == 0); } } @@ -64,8 +64,8 @@ TEST_CASE ("Testing String::compareTo(const char *) with empty buffer", "[String { char *buffer = NULL; - arduino::String str1("Hello"); - REQUIRE(str1.compareTo(buffer) != 0); + arduino::String str("Hello"); + REQUIRE(str.compareTo(buffer) != 0); } WHEN ("First string does NOT have a valid buffer") @@ -73,8 +73,8 @@ TEST_CASE ("Testing String::compareTo(const char *) with empty buffer", "[String char *buffer1 = NULL; char *buffer2 = NULL; - arduino::String str1(buffer1); - REQUIRE(str1.compareTo(buffer2) == 0); + arduino::String str(buffer1); + REQUIRE(str.compareTo(buffer2) == 0); } } From 1e6d3f17f3aea63ccfd970cd5ab1b334eda27315 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 7 Sep 2023 12:56:16 +0100 Subject: [PATCH 33/61] Allow test_toAscii to compile under C++20 --- test/src/WCharacter/test_toAscii.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/src/WCharacter/test_toAscii.cpp b/test/src/WCharacter/test_toAscii.cpp index b071702f..10b54625 100644 --- a/test/src/WCharacter/test_toAscii.cpp +++ b/test/src/WCharacter/test_toAscii.cpp @@ -6,8 +6,6 @@ * INCLUDE **************************************************************************************/ -#undef _GNU_SOURCE - #include #include @@ -47,4 +45,4 @@ TEST_CASE ("toAscii(...) is called with a invalid casted ascii character", "[toA TEST_CASE ("toAscii(...) is called with a character larger than 1 byte", "[toAscii-04]") { REQUIRE(arduino::toAscii(0x3030) == 0x30); -} \ No newline at end of file +} From 17656288a5acc90239e26a3558d44118d023908c Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 7 Sep 2023 13:48:45 +0100 Subject: [PATCH 34/61] Fix deprecated volatile access in CanMsgRingbuffer + testcase --- api/CanMsgRingbuffer.cpp | 4 +-- test/CMakeLists.txt | 2 ++ test/src/CanMsgRingbuffer/test_available.cpp | 33 ++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 test/src/CanMsgRingbuffer/test_available.cpp diff --git a/api/CanMsgRingbuffer.cpp b/api/CanMsgRingbuffer.cpp index c358a10a..e62db89a 100644 --- a/api/CanMsgRingbuffer.cpp +++ b/api/CanMsgRingbuffer.cpp @@ -40,7 +40,7 @@ void CanMsgRingbuffer::enqueue(CanMsg const & msg) _buf[_head] = msg; _head = next(_head); - _num_elems++; + _num_elems = _num_elems + 1; } CanMsg CanMsgRingbuffer::dequeue() @@ -50,7 +50,7 @@ CanMsg CanMsgRingbuffer::dequeue() CanMsg const msg = _buf[_tail]; _tail = next(_tail); - _num_elems--; + _num_elems = _num_elems - 1; return msg; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e1ca18d2..a564faa4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,6 +33,7 @@ set(TEST_SRCS src/CanMsg/test_isStandardId.cpp src/CanMsg/test_operator_assignment.cpp src/CanMsg/test_printTo.cpp + src/CanMsgRingbuffer/test_available.cpp src/Common/test_makeWord.cpp src/Common/test_map.cpp src/Common/test_max.cpp @@ -104,6 +105,7 @@ set(TEST_SRCS set(TEST_DUT_SRCS ../api/CanMsg.cpp + ../api/CanMsgRingbuffer.cpp ../api/Common.cpp ../api/IPAddress.cpp ../api/String.cpp diff --git a/test/src/CanMsgRingbuffer/test_available.cpp b/test/src/CanMsgRingbuffer/test_available.cpp new file mode 100644 index 00000000..ba857c4b --- /dev/null +++ b/test/src/CanMsgRingbuffer/test_available.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("'available' should return 0 for empty CanMsg ring buffer", "[CanMsgRingbuffer-available-01]") +{ + arduino::CanMsgRingbuffer ringbuffer; + REQUIRE(ringbuffer.available() == 0); +} + +TEST_CASE ("'available' should return number of elements in CanMsg ringbuffer", "[CanMsgRingbuffer-available-02]") +{ + arduino::CanMsgRingbuffer ringbuffer; + arduino::CanMsg msg; + ringbuffer.enqueue(msg); + REQUIRE(ringbuffer.available() == 1); + ringbuffer.enqueue(msg); + REQUIRE(ringbuffer.available() == 2); + ringbuffer.dequeue(); + REQUIRE(ringbuffer.available() == 1); +} From e9d383d19a9535180dad5776458358586ac853a6 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 7 Sep 2023 23:16:25 +0100 Subject: [PATCH 35/61] Allow tests to run on systems with case-insensive files. Also adds pragmas to suppress warnings treated as fatal --- api/IPAddress.cpp | 6 ++++++ api/deprecated-avr-comp/avr/dtostrf.c.impl | 3 +++ test/CMakeLists.txt | 2 +- test/include/MillisFake.h | 2 +- test/include/PrintMock.h | 2 +- test/include/PrintableMock.h | 2 +- test/include/StreamMock.h | 2 +- test/src/CanMsg/test_CanExtendedId.cpp | 2 +- test/src/CanMsg/test_CanMsg.cpp | 2 +- test/src/CanMsg/test_CanMsg_CopyCtor.cpp | 2 +- test/src/CanMsg/test_CanStandardId.cpp | 2 +- test/src/CanMsg/test_isExtendedId.cpp | 2 +- test/src/CanMsg/test_isStandardId.cpp | 2 +- test/src/CanMsg/test_operator_assignment.cpp | 2 +- test/src/CanMsg/test_printTo.cpp | 2 +- test/src/CanMsgRingbuffer/test_available.cpp | 2 +- test/src/Common/test_makeWord.cpp | 2 +- test/src/Common/test_map.cpp | 2 +- test/src/Common/test_max.cpp | 6 +++--- test/src/Common/test_min.cpp | 6 +++--- test/src/IPAddress/test_IPAddress.cpp | 2 +- test/src/IPAddress/test_IPAddress6.cpp | 2 +- test/src/IPAddress/test_fromString.cpp | 4 ++-- test/src/IPAddress/test_fromString6.cpp | 4 ++-- test/src/IPAddress/test_operator_assignment.cpp | 2 +- test/src/IPAddress/test_operator_comparison.cpp | 2 +- test/src/IPAddress/test_operator_comparison6.cpp | 2 +- test/src/IPAddress/test_operator_parentheses.cpp | 2 +- test/src/IPAddress/test_operator_parentheses6.cpp | 2 +- test/src/IPAddress/test_printTo.cpp | 2 +- test/src/IPAddress/test_printTo6.cpp | 2 +- test/src/IPAddress/test_toString.cpp | 4 ++-- test/src/Print/test_availableForWrite.cpp | 2 +- test/src/Print/test_clearWriteError.cpp | 2 +- test/src/Print/test_getWriteError.cpp | 2 +- test/src/Print/test_print.cpp | 2 +- test/src/Print/test_println.cpp | 2 +- test/src/Ringbuffer/test_available.cpp | 2 +- test/src/Ringbuffer/test_availableForStore.cpp | 2 +- test/src/Ringbuffer/test_clear.cpp | 2 +- test/src/Ringbuffer/test_isFull.cpp | 2 +- test/src/Ringbuffer/test_peek.cpp | 2 +- test/src/Ringbuffer/test_read_char.cpp | 2 +- test/src/Ringbuffer/test_store_char.cpp | 2 +- test/src/String/StringPrinter.h | 2 +- test/src/String/test_String.cpp | 2 +- test/src/String/test_characterAccessFunc.cpp | 2 +- test/src/String/test_compareTo.cpp | 2 +- test/src/String/test_comparisonFunc.cpp | 2 +- test/src/String/test_concat.cpp | 2 +- test/src/String/test_indexOf.cpp | 2 +- test/src/String/test_lastIndexOf.cpp | 2 +- test/src/String/test_length.cpp | 2 +- test/src/String/test_move.cpp | 5 ++++- test/src/String/test_operators.cpp | 2 +- test/src/String/test_remove.cpp | 2 +- test/src/String/test_replace.cpp | 2 +- test/src/String/test_substring.cpp | 2 +- test/src/String/test_toDouble.cpp | 2 +- test/src/String/test_toFloat.cpp | 2 +- test/src/String/test_toInt.cpp | 2 +- test/src/String/test_toLowerCase.cpp | 2 +- test/src/String/test_toUpperCase.cpp | 2 +- test/src/String/test_trim.cpp | 2 +- test/src/WCharacter/test_isAscii.cpp | 2 +- test/src/WCharacter/test_isControl.cpp | 2 +- test/src/WCharacter/test_isDigit.cpp | 2 +- test/src/WCharacter/test_isHexadecimalDigit.cpp | 2 +- test/src/WCharacter/test_isLowerCase.cpp | 2 +- test/src/WCharacter/test_isPunct.cpp | 2 +- test/src/WCharacter/test_isSpace.cpp | 2 +- test/src/WCharacter/test_isUpperCase.cpp | 2 +- test/src/WCharacter/test_isWhitespace.cpp | 2 +- test/src/WCharacter/test_toAscii.cpp | 2 +- test/src/dtostrf.cpp | 4 ++-- test/src/itoa.cpp | 14 +++++++++++++- 76 files changed, 106 insertions(+), 82 deletions(-) diff --git a/api/IPAddress.cpp b/api/IPAddress.cpp index 1d775906..4053be61 100644 --- a/api/IPAddress.cpp +++ b/api/IPAddress.cpp @@ -96,13 +96,18 @@ IPAddress::IPAddress(const char *address) String IPAddress::toString4() const { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" char szRet[16]; sprintf(szRet,"%u.%u.%u.%u", _address.bytes[IPADDRESS_V4_BYTES_INDEX], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 1], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 2], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 3]); return String(szRet); +#pragma GCC diagnostic pop } String IPAddress::toString6() const { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" char szRet[40]; sprintf(szRet,"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3], @@ -110,6 +115,7 @@ String IPAddress::toString6() const _address.bytes[8], _address.bytes[9], _address.bytes[10], _address.bytes[11], _address.bytes[12], _address.bytes[13], _address.bytes[14], _address.bytes[15]); return String(szRet); +#pragma GCC diagnostic pop } String IPAddress::toString() const diff --git a/api/deprecated-avr-comp/avr/dtostrf.c.impl b/api/deprecated-avr-comp/avr/dtostrf.c.impl index 96987a8f..f410886c 100644 --- a/api/deprecated-avr-comp/avr/dtostrf.c.impl +++ b/api/deprecated-avr-comp/avr/dtostrf.c.impl @@ -29,9 +29,12 @@ char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { asm(".global _printf_float"); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" char fmt[20]; sprintf(fmt, "%%%d.%df", width, prec); sprintf(sout, fmt, val); return sout; +#pragma GCC diagnostic pop } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a564faa4..f6bcc123 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,7 +8,7 @@ project(test-ArduinoCore-API) ########################################################################## -include_directories(../api) +include_directories(..) include_directories(include) include_directories(external/catch/v2.13.9/include) diff --git a/test/include/MillisFake.h b/test/include/MillisFake.h index da21049b..4f44387e 100644 --- a/test/include/MillisFake.h +++ b/test/include/MillisFake.h @@ -9,7 +9,7 @@ * INCLUDE **************************************************************************************/ -#include +#include "api/Common.h" /************************************************************************************** * FUNCTION DECLARATION diff --git a/test/include/PrintMock.h b/test/include/PrintMock.h index 87c83313..188fc1a0 100644 --- a/test/include/PrintMock.h +++ b/test/include/PrintMock.h @@ -11,7 +11,7 @@ #include -#include +#include "api/Print.h" /************************************************************************************** * CLASS DECLARATION diff --git a/test/include/PrintableMock.h b/test/include/PrintableMock.h index cfc00555..59282d1d 100644 --- a/test/include/PrintableMock.h +++ b/test/include/PrintableMock.h @@ -11,7 +11,7 @@ #include -#include +#include "api/Printable.h" /************************************************************************************** * CLASS DECLARATION diff --git a/test/include/StreamMock.h b/test/include/StreamMock.h index 91eb3c26..1e0adaaf 100644 --- a/test/include/StreamMock.h +++ b/test/include/StreamMock.h @@ -11,7 +11,7 @@ #include -#include +#include "api/Stream.h" /************************************************************************************** * CLASS DECLARATION diff --git a/test/src/CanMsg/test_CanExtendedId.cpp b/test/src/CanMsg/test_CanExtendedId.cpp index 72f8ece5..6d3d71d5 100644 --- a/test/src/CanMsg/test_CanExtendedId.cpp +++ b/test/src/CanMsg/test_CanExtendedId.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_CanMsg.cpp b/test/src/CanMsg/test_CanMsg.cpp index 14b8a76a..d4972a20 100644 --- a/test/src/CanMsg/test_CanMsg.cpp +++ b/test/src/CanMsg/test_CanMsg.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp index b303369a..679c4059 100644 --- a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp +++ b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_CanStandardId.cpp b/test/src/CanMsg/test_CanStandardId.cpp index 02496241..d274e688 100644 --- a/test/src/CanMsg/test_CanStandardId.cpp +++ b/test/src/CanMsg/test_CanStandardId.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_isExtendedId.cpp b/test/src/CanMsg/test_isExtendedId.cpp index 3a12ab8f..16430512 100644 --- a/test/src/CanMsg/test_isExtendedId.cpp +++ b/test/src/CanMsg/test_isExtendedId.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_isStandardId.cpp b/test/src/CanMsg/test_isStandardId.cpp index 718d2535..b63625a6 100644 --- a/test/src/CanMsg/test_isStandardId.cpp +++ b/test/src/CanMsg/test_isStandardId.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_operator_assignment.cpp b/test/src/CanMsg/test_operator_assignment.cpp index ae2d2ecb..943c228c 100644 --- a/test/src/CanMsg/test_operator_assignment.cpp +++ b/test/src/CanMsg/test_operator_assignment.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_printTo.cpp b/test/src/CanMsg/test_printTo.cpp index dd1fb4b8..2efd8602 100644 --- a/test/src/CanMsg/test_printTo.cpp +++ b/test/src/CanMsg/test_printTo.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsg.h" #include /************************************************************************************** diff --git a/test/src/CanMsgRingbuffer/test_available.cpp b/test/src/CanMsgRingbuffer/test_available.cpp index ba857c4b..a1b68f06 100644 --- a/test/src/CanMsgRingbuffer/test_available.cpp +++ b/test/src/CanMsgRingbuffer/test_available.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/CanMsgRingbuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_makeWord.cpp b/test/src/Common/test_makeWord.cpp index 2e0a29dc..5f57075a 100644 --- a/test/src/Common/test_makeWord.cpp +++ b/test/src/Common/test_makeWord.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Common.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_map.cpp b/test/src/Common/test_map.cpp index aef3e72a..0c2a2b2a 100644 --- a/test/src/Common/test_map.cpp +++ b/test/src/Common/test_map.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Common.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_max.cpp b/test/src/Common/test_max.cpp index 6612cc95..7afd201e 100644 --- a/test/src/Common/test_max.cpp +++ b/test/src/Common/test_max.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Common.h" /************************************************************************************** * TEST CODE @@ -53,7 +53,7 @@ TEST_CASE ("Calling 'max(a,b)' with type(a) != type(b)", "[max-04]") { uint32_t const a = 32; uint64_t const b = 10; - REQUIRE(typeid(max(a,b)) == typeid(unsigned long)); + REQUIRE(typeid(max(a,b)) == typeid(uint64_t)); } WHEN("type(A) = int8_t, type(b) = int16_t") { @@ -71,6 +71,6 @@ TEST_CASE ("Calling 'max(a,b)' with type(a) != type(b)", "[max-04]") { int32_t const a = -32; int64_t const b = -10; - REQUIRE(typeid(max(a,b)) == typeid(long)); + REQUIRE(typeid(max(a,b)) == typeid(int64_t)); } } diff --git a/test/src/Common/test_min.cpp b/test/src/Common/test_min.cpp index 2298dc6c..d9c3775a 100644 --- a/test/src/Common/test_min.cpp +++ b/test/src/Common/test_min.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Common.h" /************************************************************************************** * TEST CODE @@ -53,7 +53,7 @@ TEST_CASE ("Calling 'min(a,b)' with type(a) != type(b)", "[min-04]") { uint32_t const a = 32; uint64_t const b = 10; - REQUIRE(typeid(min(a,b)) == typeid(unsigned long)); + REQUIRE(typeid(min(a,b)) == typeid(uint64_t)); } WHEN("type(A) = int8_t, type(b) = int16_t") { @@ -71,6 +71,6 @@ TEST_CASE ("Calling 'min(a,b)' with type(a) != type(b)", "[min-04]") { int32_t const a = -32; int64_t const b = -10; - REQUIRE(typeid(min(a,b)) == typeid(long)); + REQUIRE(typeid(min(a,b)) == typeid(int64_t)); } } diff --git a/test/src/IPAddress/test_IPAddress.cpp b/test/src/IPAddress/test_IPAddress.cpp index d12db0f3..91ff6e49 100644 --- a/test/src/IPAddress/test_IPAddress.cpp +++ b/test/src/IPAddress/test_IPAddress.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_IPAddress6.cpp b/test/src/IPAddress/test_IPAddress6.cpp index a6941b71..7fe0f690 100644 --- a/test/src/IPAddress/test_IPAddress6.cpp +++ b/test/src/IPAddress/test_IPAddress6.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_fromString.cpp b/test/src/IPAddress/test_fromString.cpp index 2c918052..d3246ee1 100644 --- a/test/src/IPAddress/test_fromString.cpp +++ b/test/src/IPAddress/test_fromString.cpp @@ -8,8 +8,8 @@ #include -#include -#include +#include "api/String.h" +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_fromString6.cpp b/test/src/IPAddress/test_fromString6.cpp index a0f09c73..0871322a 100644 --- a/test/src/IPAddress/test_fromString6.cpp +++ b/test/src/IPAddress/test_fromString6.cpp @@ -8,8 +8,8 @@ #include -#include -#include +#include "api/String.h" +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_assignment.cpp b/test/src/IPAddress/test_operator_assignment.cpp index e9fc8691..3751f2a6 100644 --- a/test/src/IPAddress/test_operator_assignment.cpp +++ b/test/src/IPAddress/test_operator_assignment.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_comparison.cpp b/test/src/IPAddress/test_operator_comparison.cpp index c3283b71..44521148 100644 --- a/test/src/IPAddress/test_operator_comparison.cpp +++ b/test/src/IPAddress/test_operator_comparison.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_comparison6.cpp b/test/src/IPAddress/test_operator_comparison6.cpp index a5e1b87c..ea811396 100644 --- a/test/src/IPAddress/test_operator_comparison6.cpp +++ b/test/src/IPAddress/test_operator_comparison6.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_parentheses.cpp b/test/src/IPAddress/test_operator_parentheses.cpp index 27fce3a5..78f76582 100644 --- a/test/src/IPAddress/test_operator_parentheses.cpp +++ b/test/src/IPAddress/test_operator_parentheses.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_parentheses6.cpp b/test/src/IPAddress/test_operator_parentheses6.cpp index 5b4740c8..d795e4df 100644 --- a/test/src/IPAddress/test_operator_parentheses6.cpp +++ b/test/src/IPAddress/test_operator_parentheses6.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_printTo.cpp b/test/src/IPAddress/test_printTo.cpp index 05e43fa5..e00a0163 100644 --- a/test/src/IPAddress/test_printTo.cpp +++ b/test/src/IPAddress/test_printTo.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" #include /************************************************************************************** diff --git a/test/src/IPAddress/test_printTo6.cpp b/test/src/IPAddress/test_printTo6.cpp index 621008af..f1e72243 100644 --- a/test/src/IPAddress/test_printTo6.cpp +++ b/test/src/IPAddress/test_printTo6.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/IPAddress.h" #include /************************************************************************************** diff --git a/test/src/IPAddress/test_toString.cpp b/test/src/IPAddress/test_toString.cpp index a5a5f004..a172d9f4 100644 --- a/test/src/IPAddress/test_toString.cpp +++ b/test/src/IPAddress/test_toString.cpp @@ -8,8 +8,8 @@ #include -#include -#include +#include "api/String.h" +#include "api/IPAddress.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Print/test_availableForWrite.cpp b/test/src/Print/test_availableForWrite.cpp index 47f599cf..eed150dd 100644 --- a/test/src/Print/test_availableForWrite.cpp +++ b/test/src/Print/test_availableForWrite.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Print.h" #include diff --git a/test/src/Print/test_clearWriteError.cpp b/test/src/Print/test_clearWriteError.cpp index 295f4984..c7b7d2b7 100644 --- a/test/src/Print/test_clearWriteError.cpp +++ b/test/src/Print/test_clearWriteError.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Print.h" #include diff --git a/test/src/Print/test_getWriteError.cpp b/test/src/Print/test_getWriteError.cpp index ef2b1435..5f85efda 100644 --- a/test/src/Print/test_getWriteError.cpp +++ b/test/src/Print/test_getWriteError.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Print.h" #include diff --git a/test/src/Print/test_print.cpp b/test/src/Print/test_print.cpp index ac731a89..06e40f52 100644 --- a/test/src/Print/test_print.cpp +++ b/test/src/Print/test_print.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Print.h" #include #include diff --git a/test/src/Print/test_println.cpp b/test/src/Print/test_println.cpp index 977ed532..1147decd 100644 --- a/test/src/Print/test_println.cpp +++ b/test/src/Print/test_println.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/Print.h" #include #include diff --git a/test/src/Ringbuffer/test_available.cpp b/test/src/Ringbuffer/test_available.cpp index 3a79e5bc..0cb18030 100644 --- a/test/src/Ringbuffer/test_available.cpp +++ b/test/src/Ringbuffer/test_available.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_availableForStore.cpp b/test/src/Ringbuffer/test_availableForStore.cpp index 7d73d8da..35c674e0 100644 --- a/test/src/Ringbuffer/test_availableForStore.cpp +++ b/test/src/Ringbuffer/test_availableForStore.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_clear.cpp b/test/src/Ringbuffer/test_clear.cpp index 165a5bbb..3c9055dc 100644 --- a/test/src/Ringbuffer/test_clear.cpp +++ b/test/src/Ringbuffer/test_clear.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_isFull.cpp b/test/src/Ringbuffer/test_isFull.cpp index 8d9c4aaa..f05b379a 100644 --- a/test/src/Ringbuffer/test_isFull.cpp +++ b/test/src/Ringbuffer/test_isFull.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_peek.cpp b/test/src/Ringbuffer/test_peek.cpp index 3811dd39..596b3a46 100644 --- a/test/src/Ringbuffer/test_peek.cpp +++ b/test/src/Ringbuffer/test_peek.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_read_char.cpp b/test/src/Ringbuffer/test_read_char.cpp index de754275..525baf4a 100644 --- a/test/src/Ringbuffer/test_read_char.cpp +++ b/test/src/Ringbuffer/test_read_char.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_store_char.cpp b/test/src/Ringbuffer/test_store_char.cpp index 6e127b28..932542f0 100644 --- a/test/src/Ringbuffer/test_store_char.cpp +++ b/test/src/Ringbuffer/test_store_char.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/RingBuffer.h" /************************************************************************************** * TEST CODE diff --git a/test/src/String/StringPrinter.h b/test/src/String/StringPrinter.h index f338a902..00cca761 100644 --- a/test/src/String/StringPrinter.h +++ b/test/src/String/StringPrinter.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include "api/String.h" namespace Catch { /** diff --git a/test/src/String/test_String.cpp b/test/src/String/test_String.cpp index 461f2d08..c6af21b7 100644 --- a/test/src/String/test_String.cpp +++ b/test/src/String/test_String.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_characterAccessFunc.cpp b/test/src/String/test_characterAccessFunc.cpp index d0f02383..e8dfe12e 100644 --- a/test/src/String/test_characterAccessFunc.cpp +++ b/test/src/String/test_characterAccessFunc.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_compareTo.cpp b/test/src/String/test_compareTo.cpp index 714d169a..ed5c2303 100644 --- a/test/src/String/test_compareTo.cpp +++ b/test/src/String/test_compareTo.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_comparisonFunc.cpp b/test/src/String/test_comparisonFunc.cpp index 89a7f3be..3687d5a7 100644 --- a/test/src/String/test_comparisonFunc.cpp +++ b/test/src/String/test_comparisonFunc.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_concat.cpp b/test/src/String/test_concat.cpp index b7390b64..6b4be20c 100644 --- a/test/src/String/test_concat.cpp +++ b/test/src/String/test_concat.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_indexOf.cpp b/test/src/String/test_indexOf.cpp index bcaf65ef..3faaa518 100644 --- a/test/src/String/test_indexOf.cpp +++ b/test/src/String/test_indexOf.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_lastIndexOf.cpp b/test/src/String/test_lastIndexOf.cpp index 2ae95f54..62b36717 100644 --- a/test/src/String/test_lastIndexOf.cpp +++ b/test/src/String/test_lastIndexOf.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_length.cpp b/test/src/String/test_length.cpp index 3b47faed..977d98d9 100644 --- a/test/src/String/test_length.cpp +++ b/test/src/String/test_length.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_move.cpp b/test/src/String/test_move.cpp index d37630c4..ab8b4398 100644 --- a/test/src/String/test_move.cpp +++ b/test/src/String/test_move.cpp @@ -1,6 +1,6 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" @@ -32,6 +32,9 @@ TEST_CASE("Testing String move assignment", "[String-move-02]") TEST_CASE("Testing String move self assignment", "[String-move-03]") { arduino::String a("src"); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-move" a = std::move(a); +#pragma GCC diagnostic pop REQUIRE(a == "src"); } diff --git a/test/src/String/test_operators.cpp b/test/src/String/test_operators.cpp index 67cb39be..c1c77ead 100644 --- a/test/src/String/test_operators.cpp +++ b/test/src/String/test_operators.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_remove.cpp b/test/src/String/test_remove.cpp index e8c19536..1c09fa93 100644 --- a/test/src/String/test_remove.cpp +++ b/test/src/String/test_remove.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_replace.cpp b/test/src/String/test_replace.cpp index d4f28bf5..b6b795a8 100644 --- a/test/src/String/test_replace.cpp +++ b/test/src/String/test_replace.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_substring.cpp b/test/src/String/test_substring.cpp index 8fa43086..94323690 100644 --- a/test/src/String/test_substring.cpp +++ b/test/src/String/test_substring.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_toDouble.cpp b/test/src/String/test_toDouble.cpp index 246f25d4..05d75bb7 100644 --- a/test/src/String/test_toDouble.cpp +++ b/test/src/String/test_toDouble.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_toFloat.cpp b/test/src/String/test_toFloat.cpp index afef02c5..6ea6031a 100644 --- a/test/src/String/test_toFloat.cpp +++ b/test/src/String/test_toFloat.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_toInt.cpp b/test/src/String/test_toInt.cpp index 43397b76..f7916de7 100644 --- a/test/src/String/test_toInt.cpp +++ b/test/src/String/test_toInt.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_toLowerCase.cpp b/test/src/String/test_toLowerCase.cpp index 1ff81e91..120816ca 100644 --- a/test/src/String/test_toLowerCase.cpp +++ b/test/src/String/test_toLowerCase.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_toUpperCase.cpp b/test/src/String/test_toUpperCase.cpp index b8ae6aaf..baef69d4 100644 --- a/test/src/String/test_toUpperCase.cpp +++ b/test/src/String/test_toUpperCase.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/String/test_trim.cpp b/test/src/String/test_trim.cpp index 539d6568..480d3c61 100644 --- a/test/src/String/test_trim.cpp +++ b/test/src/String/test_trim.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/String.h" #include "StringPrinter.h" diff --git a/test/src/WCharacter/test_isAscii.cpp b/test/src/WCharacter/test_isAscii.cpp index 8c2763c4..e5bb196c 100644 --- a/test/src/WCharacter/test_isAscii.cpp +++ b/test/src/WCharacter/test_isAscii.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isControl.cpp b/test/src/WCharacter/test_isControl.cpp index 157c8bc8..d6d5d249 100644 --- a/test/src/WCharacter/test_isControl.cpp +++ b/test/src/WCharacter/test_isControl.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isDigit.cpp b/test/src/WCharacter/test_isDigit.cpp index 58b1808a..23178585 100644 --- a/test/src/WCharacter/test_isDigit.cpp +++ b/test/src/WCharacter/test_isDigit.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isHexadecimalDigit.cpp b/test/src/WCharacter/test_isHexadecimalDigit.cpp index 0eba5846..0aafe6d7 100644 --- a/test/src/WCharacter/test_isHexadecimalDigit.cpp +++ b/test/src/WCharacter/test_isHexadecimalDigit.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isLowerCase.cpp b/test/src/WCharacter/test_isLowerCase.cpp index 79e1dbc4..85642d06 100644 --- a/test/src/WCharacter/test_isLowerCase.cpp +++ b/test/src/WCharacter/test_isLowerCase.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * TEST CODE diff --git a/test/src/WCharacter/test_isPunct.cpp b/test/src/WCharacter/test_isPunct.cpp index 5f6875d1..ad0edbf2 100644 --- a/test/src/WCharacter/test_isPunct.cpp +++ b/test/src/WCharacter/test_isPunct.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isSpace.cpp b/test/src/WCharacter/test_isSpace.cpp index c96557d6..f9d643e5 100644 --- a/test/src/WCharacter/test_isSpace.cpp +++ b/test/src/WCharacter/test_isSpace.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isUpperCase.cpp b/test/src/WCharacter/test_isUpperCase.cpp index e21e33db..ecbdd4fa 100644 --- a/test/src/WCharacter/test_isUpperCase.cpp +++ b/test/src/WCharacter/test_isUpperCase.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * TEST CODE diff --git a/test/src/WCharacter/test_isWhitespace.cpp b/test/src/WCharacter/test_isWhitespace.cpp index 6eb3f7a6..1ed7b20c 100644 --- a/test/src/WCharacter/test_isWhitespace.cpp +++ b/test/src/WCharacter/test_isWhitespace.cpp @@ -8,7 +8,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * TEST CODE diff --git a/test/src/WCharacter/test_toAscii.cpp b/test/src/WCharacter/test_toAscii.cpp index 10b54625..9954dda6 100644 --- a/test/src/WCharacter/test_toAscii.cpp +++ b/test/src/WCharacter/test_toAscii.cpp @@ -10,7 +10,7 @@ #include -#include +#include "api/WCharacter.h" /************************************************************************************** * CONSTANTS diff --git a/test/src/dtostrf.cpp b/test/src/dtostrf.cpp index 0635b492..d21c8737 100644 --- a/test/src/dtostrf.cpp +++ b/test/src/dtostrf.cpp @@ -6,7 +6,7 @@ * INCLUDE **************************************************************************************/ -#include +#include "api/deprecated-avr-comp/avr/dtostrf.h" #include @@ -18,7 +18,7 @@ extern "C" { #endif -#include +#include "api/deprecated-avr-comp/avr/dtostrf.c.impl" #ifdef __cplusplus } // extern "C" diff --git a/test/src/itoa.cpp b/test/src/itoa.cpp index 84d640c3..5c893905 100644 --- a/test/src/itoa.cpp +++ b/test/src/itoa.cpp @@ -6,7 +6,7 @@ * INCLUDE **************************************************************************************/ -#include +#include "api/itoa.h" #include #include @@ -27,24 +27,36 @@ std::string radixToFmtString(int const radix) char * itoa(int value, char * str, int radix) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" sprintf(str, radixToFmtString(radix).c_str(), value); +#pragma GCC diagnostic pop return str; } char * ltoa(long value, char * str, int radix) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" sprintf(str, radixToFmtString(radix).c_str(), value); +#pragma GCC diagnostic pop return str; } char * utoa(unsigned value, char *str, int radix) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" sprintf(str, radixToFmtString(radix).c_str(), value); +#pragma GCC diagnostic pop return str; } char * ultoa(unsigned long value, char * str, int radix) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" sprintf(str, radixToFmtString(radix).c_str(), value); +#pragma GCC diagnostic pop return str; } From 59b42bbed6c1773a78fe6052870bc7b2ecc162c4 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 7 Sep 2023 23:32:49 +0100 Subject: [PATCH 36/61] -Wself-move was added in GCC 13 --- test/src/String/test_move.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/src/String/test_move.cpp b/test/src/String/test_move.cpp index ab8b4398..4ac5deab 100644 --- a/test/src/String/test_move.cpp +++ b/test/src/String/test_move.cpp @@ -31,10 +31,14 @@ TEST_CASE("Testing String move assignment", "[String-move-02]") TEST_CASE("Testing String move self assignment", "[String-move-03]") { - arduino::String a("src"); +#if defined(GCC_VERSION) && GCC_VERSION >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-move" +#endif + arduino::String a("src"); a = std::move(a); -#pragma GCC diagnostic pop REQUIRE(a == "src"); +#if defined(GCC_VERSION) && GCC_VERSION >= 13 +#pragma GCC diagnostic pop +#endif } From 21ef2c619bbe15890562193e97ade37cf6436f52 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 7 Sep 2023 23:56:03 +0100 Subject: [PATCH 37/61] Also check the versioa for clang --- test/src/String/test_move.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/String/test_move.cpp b/test/src/String/test_move.cpp index 4ac5deab..f5b65032 100644 --- a/test/src/String/test_move.cpp +++ b/test/src/String/test_move.cpp @@ -31,7 +31,7 @@ TEST_CASE("Testing String move assignment", "[String-move-02]") TEST_CASE("Testing String move self assignment", "[String-move-03]") { -#if defined(GCC_VERSION) && GCC_VERSION >= 13 +#if (defined(GCC_VERSION) && GCC_VERSION >= 13) || (defined(__clang_major__) && __clang_major__ >= 14) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-move" #endif From da415e6da3a634701704df85c6842e66ed4777b5 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Fri, 8 Sep 2023 07:30:00 +0100 Subject: [PATCH 38/61] Use <> style includes in tests --- test/include/MillisFake.h | 2 +- test/include/PrintMock.h | 2 +- test/include/PrintableMock.h | 2 +- test/include/StreamMock.h | 2 +- test/src/CanMsg/test_CanExtendedId.cpp | 2 +- test/src/CanMsg/test_CanMsg.cpp | 2 +- test/src/CanMsg/test_CanMsg_CopyCtor.cpp | 2 +- test/src/CanMsg/test_CanStandardId.cpp | 2 +- test/src/CanMsg/test_isExtendedId.cpp | 2 +- test/src/CanMsg/test_isStandardId.cpp | 2 +- test/src/CanMsg/test_operator_assignment.cpp | 2 +- test/src/CanMsg/test_printTo.cpp | 2 +- test/src/CanMsgRingbuffer/test_available.cpp | 2 +- test/src/Common/test_makeWord.cpp | 2 +- test/src/Common/test_map.cpp | 2 +- test/src/Common/test_max.cpp | 2 +- test/src/Common/test_min.cpp | 2 +- test/src/IPAddress/test_IPAddress.cpp | 2 +- test/src/IPAddress/test_IPAddress6.cpp | 2 +- test/src/IPAddress/test_fromString.cpp | 4 ++-- test/src/IPAddress/test_fromString6.cpp | 4 ++-- test/src/IPAddress/test_operator_assignment.cpp | 2 +- test/src/IPAddress/test_operator_comparison.cpp | 2 +- test/src/IPAddress/test_operator_comparison6.cpp | 2 +- test/src/IPAddress/test_operator_parentheses.cpp | 2 +- test/src/IPAddress/test_operator_parentheses6.cpp | 2 +- test/src/IPAddress/test_printTo.cpp | 2 +- test/src/IPAddress/test_printTo6.cpp | 2 +- test/src/IPAddress/test_toString.cpp | 4 ++-- test/src/Print/test_availableForWrite.cpp | 2 +- test/src/Print/test_clearWriteError.cpp | 2 +- test/src/Print/test_getWriteError.cpp | 2 +- test/src/Print/test_print.cpp | 2 +- test/src/Print/test_println.cpp | 2 +- test/src/Ringbuffer/test_available.cpp | 2 +- test/src/Ringbuffer/test_availableForStore.cpp | 2 +- test/src/Ringbuffer/test_clear.cpp | 2 +- test/src/Ringbuffer/test_isFull.cpp | 2 +- test/src/Ringbuffer/test_peek.cpp | 2 +- test/src/Ringbuffer/test_read_char.cpp | 2 +- test/src/Ringbuffer/test_store_char.cpp | 2 +- test/src/String/StringPrinter.h | 2 +- test/src/String/test_String.cpp | 2 +- test/src/String/test_characterAccessFunc.cpp | 2 +- test/src/String/test_compareTo.cpp | 2 +- test/src/String/test_comparisonFunc.cpp | 2 +- test/src/String/test_concat.cpp | 2 +- test/src/String/test_indexOf.cpp | 2 +- test/src/String/test_lastIndexOf.cpp | 2 +- test/src/String/test_length.cpp | 2 +- test/src/String/test_move.cpp | 2 +- test/src/String/test_operators.cpp | 2 +- test/src/String/test_remove.cpp | 2 +- test/src/String/test_replace.cpp | 2 +- test/src/String/test_substring.cpp | 2 +- test/src/String/test_toDouble.cpp | 2 +- test/src/String/test_toFloat.cpp | 2 +- test/src/String/test_toInt.cpp | 2 +- test/src/String/test_toLowerCase.cpp | 2 +- test/src/String/test_toUpperCase.cpp | 2 +- test/src/String/test_trim.cpp | 2 +- test/src/WCharacter/test_isAscii.cpp | 2 +- test/src/WCharacter/test_isControl.cpp | 2 +- test/src/WCharacter/test_isDigit.cpp | 2 +- test/src/WCharacter/test_isHexadecimalDigit.cpp | 2 +- test/src/WCharacter/test_isLowerCase.cpp | 2 +- test/src/WCharacter/test_isPunct.cpp | 2 +- test/src/WCharacter/test_isSpace.cpp | 2 +- test/src/WCharacter/test_isUpperCase.cpp | 2 +- test/src/WCharacter/test_isWhitespace.cpp | 2 +- test/src/WCharacter/test_toAscii.cpp | 2 +- test/src/dtostrf.cpp | 4 ++-- test/src/itoa.cpp | 2 +- 73 files changed, 77 insertions(+), 77 deletions(-) diff --git a/test/include/MillisFake.h b/test/include/MillisFake.h index 4f44387e..be078bd0 100644 --- a/test/include/MillisFake.h +++ b/test/include/MillisFake.h @@ -9,7 +9,7 @@ * INCLUDE **************************************************************************************/ -#include "api/Common.h" +#include /************************************************************************************** * FUNCTION DECLARATION diff --git a/test/include/PrintMock.h b/test/include/PrintMock.h index 188fc1a0..d41e78fa 100644 --- a/test/include/PrintMock.h +++ b/test/include/PrintMock.h @@ -11,7 +11,7 @@ #include -#include "api/Print.h" +#include /************************************************************************************** * CLASS DECLARATION diff --git a/test/include/PrintableMock.h b/test/include/PrintableMock.h index 59282d1d..39121928 100644 --- a/test/include/PrintableMock.h +++ b/test/include/PrintableMock.h @@ -11,7 +11,7 @@ #include -#include "api/Printable.h" +#include /************************************************************************************** * CLASS DECLARATION diff --git a/test/include/StreamMock.h b/test/include/StreamMock.h index 1e0adaaf..a7d9da1a 100644 --- a/test/include/StreamMock.h +++ b/test/include/StreamMock.h @@ -11,7 +11,7 @@ #include -#include "api/Stream.h" +#include /************************************************************************************** * CLASS DECLARATION diff --git a/test/src/CanMsg/test_CanExtendedId.cpp b/test/src/CanMsg/test_CanExtendedId.cpp index 6d3d71d5..a812f08b 100644 --- a/test/src/CanMsg/test_CanExtendedId.cpp +++ b/test/src/CanMsg/test_CanExtendedId.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_CanMsg.cpp b/test/src/CanMsg/test_CanMsg.cpp index d4972a20..03704623 100644 --- a/test/src/CanMsg/test_CanMsg.cpp +++ b/test/src/CanMsg/test_CanMsg.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp index 679c4059..ccf62931 100644 --- a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp +++ b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_CanStandardId.cpp b/test/src/CanMsg/test_CanStandardId.cpp index d274e688..81d2301d 100644 --- a/test/src/CanMsg/test_CanStandardId.cpp +++ b/test/src/CanMsg/test_CanStandardId.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_isExtendedId.cpp b/test/src/CanMsg/test_isExtendedId.cpp index 16430512..242866e9 100644 --- a/test/src/CanMsg/test_isExtendedId.cpp +++ b/test/src/CanMsg/test_isExtendedId.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_isStandardId.cpp b/test/src/CanMsg/test_isStandardId.cpp index b63625a6..a73bf7c1 100644 --- a/test/src/CanMsg/test_isStandardId.cpp +++ b/test/src/CanMsg/test_isStandardId.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_operator_assignment.cpp b/test/src/CanMsg/test_operator_assignment.cpp index 943c228c..0dd35543 100644 --- a/test/src/CanMsg/test_operator_assignment.cpp +++ b/test/src/CanMsg/test_operator_assignment.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include /************************************************************************************** * NAMESPACE diff --git a/test/src/CanMsg/test_printTo.cpp b/test/src/CanMsg/test_printTo.cpp index 2efd8602..bf532c81 100644 --- a/test/src/CanMsg/test_printTo.cpp +++ b/test/src/CanMsg/test_printTo.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsg.h" +#include #include /************************************************************************************** diff --git a/test/src/CanMsgRingbuffer/test_available.cpp b/test/src/CanMsgRingbuffer/test_available.cpp index a1b68f06..684eaeec 100644 --- a/test/src/CanMsgRingbuffer/test_available.cpp +++ b/test/src/CanMsgRingbuffer/test_available.cpp @@ -8,7 +8,7 @@ #include -#include "api/CanMsgRingbuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_makeWord.cpp b/test/src/Common/test_makeWord.cpp index 5f57075a..dcb3ea33 100644 --- a/test/src/Common/test_makeWord.cpp +++ b/test/src/Common/test_makeWord.cpp @@ -8,7 +8,7 @@ #include -#include "api/Common.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_map.cpp b/test/src/Common/test_map.cpp index 0c2a2b2a..59441cac 100644 --- a/test/src/Common/test_map.cpp +++ b/test/src/Common/test_map.cpp @@ -8,7 +8,7 @@ #include -#include "api/Common.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_max.cpp b/test/src/Common/test_max.cpp index 7afd201e..ccb5e5e1 100644 --- a/test/src/Common/test_max.cpp +++ b/test/src/Common/test_max.cpp @@ -8,7 +8,7 @@ #include -#include "api/Common.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Common/test_min.cpp b/test/src/Common/test_min.cpp index d9c3775a..750f41ae 100644 --- a/test/src/Common/test_min.cpp +++ b/test/src/Common/test_min.cpp @@ -8,7 +8,7 @@ #include -#include "api/Common.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_IPAddress.cpp b/test/src/IPAddress/test_IPAddress.cpp index 91ff6e49..6b66e118 100644 --- a/test/src/IPAddress/test_IPAddress.cpp +++ b/test/src/IPAddress/test_IPAddress.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_IPAddress6.cpp b/test/src/IPAddress/test_IPAddress6.cpp index 7fe0f690..3a8a5315 100644 --- a/test/src/IPAddress/test_IPAddress6.cpp +++ b/test/src/IPAddress/test_IPAddress6.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_fromString.cpp b/test/src/IPAddress/test_fromString.cpp index d3246ee1..d058b529 100644 --- a/test/src/IPAddress/test_fromString.cpp +++ b/test/src/IPAddress/test_fromString.cpp @@ -8,8 +8,8 @@ #include -#include "api/String.h" -#include "api/IPAddress.h" +#include +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_fromString6.cpp b/test/src/IPAddress/test_fromString6.cpp index 0871322a..deb54458 100644 --- a/test/src/IPAddress/test_fromString6.cpp +++ b/test/src/IPAddress/test_fromString6.cpp @@ -8,8 +8,8 @@ #include -#include "api/String.h" -#include "api/IPAddress.h" +#include +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_assignment.cpp b/test/src/IPAddress/test_operator_assignment.cpp index 3751f2a6..fdf641d4 100644 --- a/test/src/IPAddress/test_operator_assignment.cpp +++ b/test/src/IPAddress/test_operator_assignment.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_comparison.cpp b/test/src/IPAddress/test_operator_comparison.cpp index 44521148..3978c8e2 100644 --- a/test/src/IPAddress/test_operator_comparison.cpp +++ b/test/src/IPAddress/test_operator_comparison.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_comparison6.cpp b/test/src/IPAddress/test_operator_comparison6.cpp index ea811396..da03a0b3 100644 --- a/test/src/IPAddress/test_operator_comparison6.cpp +++ b/test/src/IPAddress/test_operator_comparison6.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_parentheses.cpp b/test/src/IPAddress/test_operator_parentheses.cpp index 78f76582..c1c2e375 100644 --- a/test/src/IPAddress/test_operator_parentheses.cpp +++ b/test/src/IPAddress/test_operator_parentheses.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_operator_parentheses6.cpp b/test/src/IPAddress/test_operator_parentheses6.cpp index d795e4df..b4575f4e 100644 --- a/test/src/IPAddress/test_operator_parentheses6.cpp +++ b/test/src/IPAddress/test_operator_parentheses6.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/IPAddress/test_printTo.cpp b/test/src/IPAddress/test_printTo.cpp index e00a0163..a0ed7c16 100644 --- a/test/src/IPAddress/test_printTo.cpp +++ b/test/src/IPAddress/test_printTo.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include #include /************************************************************************************** diff --git a/test/src/IPAddress/test_printTo6.cpp b/test/src/IPAddress/test_printTo6.cpp index f1e72243..7d924b63 100644 --- a/test/src/IPAddress/test_printTo6.cpp +++ b/test/src/IPAddress/test_printTo6.cpp @@ -8,7 +8,7 @@ #include -#include "api/IPAddress.h" +#include #include /************************************************************************************** diff --git a/test/src/IPAddress/test_toString.cpp b/test/src/IPAddress/test_toString.cpp index a172d9f4..f36ae549 100644 --- a/test/src/IPAddress/test_toString.cpp +++ b/test/src/IPAddress/test_toString.cpp @@ -8,8 +8,8 @@ #include -#include "api/String.h" -#include "api/IPAddress.h" +#include +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Print/test_availableForWrite.cpp b/test/src/Print/test_availableForWrite.cpp index eed150dd..c5dfbcda 100644 --- a/test/src/Print/test_availableForWrite.cpp +++ b/test/src/Print/test_availableForWrite.cpp @@ -8,7 +8,7 @@ #include -#include "api/Print.h" +#include #include diff --git a/test/src/Print/test_clearWriteError.cpp b/test/src/Print/test_clearWriteError.cpp index c7b7d2b7..720a1210 100644 --- a/test/src/Print/test_clearWriteError.cpp +++ b/test/src/Print/test_clearWriteError.cpp @@ -8,7 +8,7 @@ #include -#include "api/Print.h" +#include #include diff --git a/test/src/Print/test_getWriteError.cpp b/test/src/Print/test_getWriteError.cpp index 5f85efda..3b616411 100644 --- a/test/src/Print/test_getWriteError.cpp +++ b/test/src/Print/test_getWriteError.cpp @@ -8,7 +8,7 @@ #include -#include "api/Print.h" +#include #include diff --git a/test/src/Print/test_print.cpp b/test/src/Print/test_print.cpp index 06e40f52..2598b7f7 100644 --- a/test/src/Print/test_print.cpp +++ b/test/src/Print/test_print.cpp @@ -8,7 +8,7 @@ #include -#include "api/Print.h" +#include #include #include diff --git a/test/src/Print/test_println.cpp b/test/src/Print/test_println.cpp index 1147decd..2d2d7306 100644 --- a/test/src/Print/test_println.cpp +++ b/test/src/Print/test_println.cpp @@ -8,7 +8,7 @@ #include -#include "api/Print.h" +#include #include #include diff --git a/test/src/Ringbuffer/test_available.cpp b/test/src/Ringbuffer/test_available.cpp index 0cb18030..75b86a7f 100644 --- a/test/src/Ringbuffer/test_available.cpp +++ b/test/src/Ringbuffer/test_available.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_availableForStore.cpp b/test/src/Ringbuffer/test_availableForStore.cpp index 35c674e0..5b8415f6 100644 --- a/test/src/Ringbuffer/test_availableForStore.cpp +++ b/test/src/Ringbuffer/test_availableForStore.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_clear.cpp b/test/src/Ringbuffer/test_clear.cpp index 3c9055dc..93da03a2 100644 --- a/test/src/Ringbuffer/test_clear.cpp +++ b/test/src/Ringbuffer/test_clear.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_isFull.cpp b/test/src/Ringbuffer/test_isFull.cpp index f05b379a..c575981e 100644 --- a/test/src/Ringbuffer/test_isFull.cpp +++ b/test/src/Ringbuffer/test_isFull.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_peek.cpp b/test/src/Ringbuffer/test_peek.cpp index 596b3a46..9efe28ea 100644 --- a/test/src/Ringbuffer/test_peek.cpp +++ b/test/src/Ringbuffer/test_peek.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_read_char.cpp b/test/src/Ringbuffer/test_read_char.cpp index 525baf4a..babc27df 100644 --- a/test/src/Ringbuffer/test_read_char.cpp +++ b/test/src/Ringbuffer/test_read_char.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/Ringbuffer/test_store_char.cpp b/test/src/Ringbuffer/test_store_char.cpp index 932542f0..0becdc0f 100644 --- a/test/src/Ringbuffer/test_store_char.cpp +++ b/test/src/Ringbuffer/test_store_char.cpp @@ -8,7 +8,7 @@ #include -#include "api/RingBuffer.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/String/StringPrinter.h b/test/src/String/StringPrinter.h index 00cca761..1ddee147 100644 --- a/test/src/String/StringPrinter.h +++ b/test/src/String/StringPrinter.h @@ -1,7 +1,7 @@ #pragma once #include -#include "api/String.h" +#include namespace Catch { /** diff --git a/test/src/String/test_String.cpp b/test/src/String/test_String.cpp index c6af21b7..6d1b8152 100644 --- a/test/src/String/test_String.cpp +++ b/test/src/String/test_String.cpp @@ -10,7 +10,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_characterAccessFunc.cpp b/test/src/String/test_characterAccessFunc.cpp index e8dfe12e..49d257af 100644 --- a/test/src/String/test_characterAccessFunc.cpp +++ b/test/src/String/test_characterAccessFunc.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_compareTo.cpp b/test/src/String/test_compareTo.cpp index ed5c2303..74a3da7b 100644 --- a/test/src/String/test_compareTo.cpp +++ b/test/src/String/test_compareTo.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_comparisonFunc.cpp b/test/src/String/test_comparisonFunc.cpp index 3687d5a7..3b49bacc 100644 --- a/test/src/String/test_comparisonFunc.cpp +++ b/test/src/String/test_comparisonFunc.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_concat.cpp b/test/src/String/test_concat.cpp index 6b4be20c..ef6c6fa1 100644 --- a/test/src/String/test_concat.cpp +++ b/test/src/String/test_concat.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_indexOf.cpp b/test/src/String/test_indexOf.cpp index 3faaa518..9f32a07e 100644 --- a/test/src/String/test_indexOf.cpp +++ b/test/src/String/test_indexOf.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_lastIndexOf.cpp b/test/src/String/test_lastIndexOf.cpp index 62b36717..7f776fa6 100644 --- a/test/src/String/test_lastIndexOf.cpp +++ b/test/src/String/test_lastIndexOf.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_length.cpp b/test/src/String/test_length.cpp index 977d98d9..fae358fa 100644 --- a/test/src/String/test_length.cpp +++ b/test/src/String/test_length.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_move.cpp b/test/src/String/test_move.cpp index f5b65032..a2529b50 100644 --- a/test/src/String/test_move.cpp +++ b/test/src/String/test_move.cpp @@ -1,6 +1,6 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_operators.cpp b/test/src/String/test_operators.cpp index c1c77ead..5a3b677c 100644 --- a/test/src/String/test_operators.cpp +++ b/test/src/String/test_operators.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_remove.cpp b/test/src/String/test_remove.cpp index 1c09fa93..17b8dabb 100644 --- a/test/src/String/test_remove.cpp +++ b/test/src/String/test_remove.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_replace.cpp b/test/src/String/test_replace.cpp index b6b795a8..cfcaead0 100644 --- a/test/src/String/test_replace.cpp +++ b/test/src/String/test_replace.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_substring.cpp b/test/src/String/test_substring.cpp index 94323690..bb05d439 100644 --- a/test/src/String/test_substring.cpp +++ b/test/src/String/test_substring.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_toDouble.cpp b/test/src/String/test_toDouble.cpp index 05d75bb7..af6960e9 100644 --- a/test/src/String/test_toDouble.cpp +++ b/test/src/String/test_toDouble.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_toFloat.cpp b/test/src/String/test_toFloat.cpp index 6ea6031a..75cf94b2 100644 --- a/test/src/String/test_toFloat.cpp +++ b/test/src/String/test_toFloat.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_toInt.cpp b/test/src/String/test_toInt.cpp index f7916de7..060fdd27 100644 --- a/test/src/String/test_toInt.cpp +++ b/test/src/String/test_toInt.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_toLowerCase.cpp b/test/src/String/test_toLowerCase.cpp index 120816ca..9f6f7c9d 100644 --- a/test/src/String/test_toLowerCase.cpp +++ b/test/src/String/test_toLowerCase.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_toUpperCase.cpp b/test/src/String/test_toUpperCase.cpp index baef69d4..1bcf93fb 100644 --- a/test/src/String/test_toUpperCase.cpp +++ b/test/src/String/test_toUpperCase.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/String/test_trim.cpp b/test/src/String/test_trim.cpp index 480d3c61..c5168ecd 100644 --- a/test/src/String/test_trim.cpp +++ b/test/src/String/test_trim.cpp @@ -8,7 +8,7 @@ #include -#include "api/String.h" +#include #include "StringPrinter.h" diff --git a/test/src/WCharacter/test_isAscii.cpp b/test/src/WCharacter/test_isAscii.cpp index e5bb196c..c6792719 100644 --- a/test/src/WCharacter/test_isAscii.cpp +++ b/test/src/WCharacter/test_isAscii.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isControl.cpp b/test/src/WCharacter/test_isControl.cpp index d6d5d249..adb41ccf 100644 --- a/test/src/WCharacter/test_isControl.cpp +++ b/test/src/WCharacter/test_isControl.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isDigit.cpp b/test/src/WCharacter/test_isDigit.cpp index 23178585..146a863b 100644 --- a/test/src/WCharacter/test_isDigit.cpp +++ b/test/src/WCharacter/test_isDigit.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isHexadecimalDigit.cpp b/test/src/WCharacter/test_isHexadecimalDigit.cpp index 0aafe6d7..486a3e44 100644 --- a/test/src/WCharacter/test_isHexadecimalDigit.cpp +++ b/test/src/WCharacter/test_isHexadecimalDigit.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isLowerCase.cpp b/test/src/WCharacter/test_isLowerCase.cpp index 85642d06..9b05b458 100644 --- a/test/src/WCharacter/test_isLowerCase.cpp +++ b/test/src/WCharacter/test_isLowerCase.cpp @@ -8,7 +8,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/WCharacter/test_isPunct.cpp b/test/src/WCharacter/test_isPunct.cpp index ad0edbf2..7e6b49dc 100644 --- a/test/src/WCharacter/test_isPunct.cpp +++ b/test/src/WCharacter/test_isPunct.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isSpace.cpp b/test/src/WCharacter/test_isSpace.cpp index f9d643e5..29ed8107 100644 --- a/test/src/WCharacter/test_isSpace.cpp +++ b/test/src/WCharacter/test_isSpace.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/WCharacter/test_isUpperCase.cpp b/test/src/WCharacter/test_isUpperCase.cpp index ecbdd4fa..598bb55b 100644 --- a/test/src/WCharacter/test_isUpperCase.cpp +++ b/test/src/WCharacter/test_isUpperCase.cpp @@ -8,7 +8,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/WCharacter/test_isWhitespace.cpp b/test/src/WCharacter/test_isWhitespace.cpp index 1ed7b20c..483c6477 100644 --- a/test/src/WCharacter/test_isWhitespace.cpp +++ b/test/src/WCharacter/test_isWhitespace.cpp @@ -8,7 +8,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * TEST CODE diff --git a/test/src/WCharacter/test_toAscii.cpp b/test/src/WCharacter/test_toAscii.cpp index 9954dda6..96a2cfb9 100644 --- a/test/src/WCharacter/test_toAscii.cpp +++ b/test/src/WCharacter/test_toAscii.cpp @@ -10,7 +10,7 @@ #include -#include "api/WCharacter.h" +#include /************************************************************************************** * CONSTANTS diff --git a/test/src/dtostrf.cpp b/test/src/dtostrf.cpp index d21c8737..0700debb 100644 --- a/test/src/dtostrf.cpp +++ b/test/src/dtostrf.cpp @@ -6,7 +6,7 @@ * INCLUDE **************************************************************************************/ -#include "api/deprecated-avr-comp/avr/dtostrf.h" +#include #include @@ -18,7 +18,7 @@ extern "C" { #endif -#include "api/deprecated-avr-comp/avr/dtostrf.c.impl" +#include #ifdef __cplusplus } // extern "C" diff --git a/test/src/itoa.cpp b/test/src/itoa.cpp index 5c893905..292d0ef0 100644 --- a/test/src/itoa.cpp +++ b/test/src/itoa.cpp @@ -6,7 +6,7 @@ * INCLUDE **************************************************************************************/ -#include "api/itoa.h" +#include #include #include From 0365dc3aa6590ca14f6a65477b5a172310f005af Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Fri, 8 Sep 2023 11:48:57 +0100 Subject: [PATCH 39/61] Replace use of deprecated sprintf in IPAddress --- api/IPAddress.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/api/IPAddress.cpp b/api/IPAddress.cpp index 4053be61..05b41bc1 100644 --- a/api/IPAddress.cpp +++ b/api/IPAddress.cpp @@ -96,26 +96,20 @@ IPAddress::IPAddress(const char *address) String IPAddress::toString4() const { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" char szRet[16]; - sprintf(szRet,"%u.%u.%u.%u", _address.bytes[IPADDRESS_V4_BYTES_INDEX], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 1], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 2], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 3]); + snprintf(szRet, sizeof(szRet), "%u.%u.%u.%u", _address.bytes[IPADDRESS_V4_BYTES_INDEX], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 1], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 2], _address.bytes[IPADDRESS_V4_BYTES_INDEX + 3]); return String(szRet); -#pragma GCC diagnostic pop } String IPAddress::toString6() const { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" char szRet[40]; - sprintf(szRet,"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + snprintf(szRet, sizeof(szRet), "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3], _address.bytes[4], _address.bytes[5], _address.bytes[6], _address.bytes[7], _address.bytes[8], _address.bytes[9], _address.bytes[10], _address.bytes[11], _address.bytes[12], _address.bytes[13], _address.bytes[14], _address.bytes[15]); return String(szRet); -#pragma GCC diagnostic pop } String IPAddress::toString() const From c9346ee9b24fcad30414bfdb43d0ec6da4bc22bb Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Sat, 9 Sep 2023 09:44:48 +0100 Subject: [PATCH 40/61] Remove guards as we alread require C++11 --- api/String.cpp | 6 ------ api/String.h | 6 ------ 2 files changed, 12 deletions(-) diff --git a/api/String.cpp b/api/String.cpp index 69125aa2..4f176374 100644 --- a/api/String.cpp +++ b/api/String.cpp @@ -63,7 +63,6 @@ String::String(const __FlashStringHelper *pstr) *this = pstr; } -#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String::String(String &&rval) : buffer(rval.buffer) , capacity(rval.capacity) @@ -73,7 +72,6 @@ String::String(String &&rval) rval.capacity = 0; rval.len = 0; } -#endif String::String(char c) { @@ -213,7 +211,6 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length) return *this; } -#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) void String::move(String &rhs) { if (this != &rhs) @@ -229,7 +226,6 @@ void String::move(String &rhs) rhs.capacity = 0; } } -#endif String & String::operator = (const String &rhs) { @@ -241,13 +237,11 @@ String & String::operator = (const String &rhs) return *this; } -#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String & String::operator = (String &&rval) { move(rval); return *this; } -#endif String & String::operator = (const char *cstr) { diff --git a/api/String.h b/api/String.h index 03ecf442..73a872de 100644 --- a/api/String.h +++ b/api/String.h @@ -72,9 +72,7 @@ class String String(const uint8_t *cstr, unsigned int length) : String((const char*)cstr, length) {} String(const String &str); String(const __FlashStringHelper *str); - #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String(String &&rval); - #endif explicit String(char c); explicit String(unsigned char, unsigned char base=10); explicit String(int, unsigned char base=10); @@ -98,9 +96,7 @@ class String String & operator = (const String &rhs); String & operator = (const char *cstr); String & operator = (const __FlashStringHelper *str); - #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String & operator = (String &&rval); - #endif // concatenate (works w/ built-in types) @@ -231,9 +227,7 @@ class String // copy and move String & copy(const char *cstr, unsigned int length); String & copy(const __FlashStringHelper *pstr, unsigned int length); - #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) void move(String &rhs); - #endif }; class StringSumHelper : public String From 2d958fa3406c86391533b99fad9c5766e321e82d Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 14 Sep 2023 07:39:22 +0100 Subject: [PATCH 41/61] Document that C++11 is required --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 16367ce5..f1a2d3f8 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ In order to compile a core which is implementing ArduinoCore-API you'll need to tar --exclude='*.git*' -cjhvf $yourcore-$version.tar.bz2 $yourcore/ ``` +The API is coded to the C++11 standard and the core's compiler must be able to support that version of the language. + Documentation for how to integrate with a Arduino core (which is necessary if you do not download the Arduino core via the Boards Manager) can be found here: * [ArduinoCore-megaavr](https://github.com/arduino/ArduinoCore-megaavr#developing) * [ArduinoCore-mbed](https://github.com/arduino/ArduinoCore-mbed#clone-the-repository-in-sketchbookhardwarearduino-git) From f1ae7d0ebaa74e66a11333087f884fe040d6cecf Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 20 Sep 2023 12:53:58 +0200 Subject: [PATCH 42/61] List ArduinoCore-renesas as core using ArduinoCore-API (#215) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f1a2d3f8..506569a8 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ As of now, the following official cores are utilising ArduinoCore-API: * [megaavr](https://github.com/arduino/ArduinoCore-megaAVR) * [mbed](https://github.com/arduino/ArduinoCore-mbed) * [samd](https://github.com/arduino/ArduinoCore-samd) +* [renesas](https://github.com/arduino/ArduinoCore-renesas) There's an ongoing effort to port the others, while maintainers of third-party cores are strongly invited to follow the same route in order to stay up-to-date with the new language features. For backwards compatibility, every revision of this repo will increase the `ARDUINO_API_VERSION` define. From fc4a570464c852bf8b464798cf998def82c35e7b Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 26 Sep 2023 10:33:41 +0200 Subject: [PATCH 43/61] Fix: do not call "memcpy" if there is a) no data to copy, or the src pointer is null. --- api/CanMsg.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index dfece0d6..eaa3f0ed 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -45,7 +45,8 @@ class CanMsg : public Printable , data_length{min(can_data_len, MAX_DATA_LENGTH)} , data{0} { - memcpy(data, can_data_ptr, data_length); + if (data_length && can_data_ptr) + memcpy(data, can_data_ptr, data_length); } CanMsg() : CanMsg(0, 0, nullptr) { } @@ -54,7 +55,8 @@ class CanMsg : public Printable { this->id = other.id; this->data_length = other.data_length; - memcpy(this->data, other.data, this->data_length); + if (this->data_length && other.data) + memcpy(this->data, other.data, this->data_length); } virtual ~CanMsg() { } @@ -65,7 +67,8 @@ class CanMsg : public Printable { this->id = other.id; this->data_length = other.data_length; - memcpy(this->data, other.data, this->data_length); + if (this->data_length && other.data) + memcpy(this->data, other.data, this->data_length); } return (*this); } From 6a263a1959c7affb8db2d82b77835a2ed02b2f95 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 2 Nov 2023 13:39:21 +0000 Subject: [PATCH 44/61] Add documentation for CAN API --- api/HardwareCAN.h | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/api/HardwareCAN.h b/api/HardwareCAN.h index 6dc87ebc..a5b87604 100644 --- a/api/HardwareCAN.h +++ b/api/HardwareCAN.h @@ -44,12 +44,56 @@ class HardwareCAN virtual ~HardwareCAN() {} + /** + * Initialize the CAN controller. + * + * @param can_bitrate the bus bit rate + * @return true if initialization succeeded and the controller is operational + */ virtual bool begin(CanBitRate const can_bitrate) = 0; - virtual void end() = 0; + /** + * Disable the CAN controller. + * + * Whether any messages that are buffered will be sent is _implementation defined_. + */ + virtual void end() = 0; + /** + * Enqueue a message for transmission to the CAN bus. + * + * This call returns when the message has been enqueued for transmission. + * Due to bus arbitration and error recovery there may be a substantial delay + * before the message is actually sent. + * + * An implementation must ensure that all messages with the same CAN priority + * are sent in the order in which they are enqueued. + * + * It is _implementation defined_ whether multiple messages can be enqueued + * for transmission, and if messages with higher CAN priority can preempt the + * transmission of previously enqueued messages. The default configuration for + * and implementation should not allow multiple messages to be enqueued. + * + * @param msg the message to send + * @return 1 if the message was enqueued, an _implementation defined_ error code < 0 if there was an error + * @todo define specific error codes, especially "message already pending" + */ virtual int write(CanMsg const &msg) = 0; + + /** + * Determine if any messages have been received and buffered. + * + * @return the number of unread messages that have been received + */ virtual size_t available() = 0; + + /** + * Returns the first message received, or an empty message if none are available. + * + * Messages must be returned in the order received. + * + * @return the first message in the receive buffer + */ virtual CanMsg read() = 0; }; From 21eb9650ab6734054a142a4853fae4dccbfe9532 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 2 Nov 2023 15:09:40 +0000 Subject: [PATCH 45/61] Fix #217 issue with compiling with newer compiler --- api/CanMsg.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index eaa3f0ed..b26a48b5 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -51,12 +51,7 @@ class CanMsg : public Printable CanMsg() : CanMsg(0, 0, nullptr) { } - CanMsg(CanMsg const & other) - { - this->id = other.id; - this->data_length = other.data_length; - if (this->data_length && other.data) - memcpy(this->data, other.data, this->data_length); + CanMsg(CanMsg const & other) : CanMsg(other.id, other.data_length, other.data) { } virtual ~CanMsg() { } @@ -65,10 +60,10 @@ class CanMsg : public Printable { if (this != &other) { - this->id = other.id; - this->data_length = other.data_length; - if (this->data_length && other.data) - memcpy(this->data, other.data, this->data_length); + id = other.id; + data_length = other.data_length; + if (data_length > 0) + memcpy(data, other.data, data_length); } return (*this); } From 5ba50100429f04798f877a09feb69b581a9f4d7f Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Fri, 3 Nov 2023 09:33:36 +0000 Subject: [PATCH 46/61] Don't use construtor delegation --- api/CanMsg.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index b26a48b5..cae7cc10 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -51,7 +51,11 @@ class CanMsg : public Printable CanMsg() : CanMsg(0, 0, nullptr) { } - CanMsg(CanMsg const & other) : CanMsg(other.id, other.data_length, other.data) { + CanMsg(CanMsg const & other) { + id = other.id; + data_length = other.data_length; + if (data_length > 0) + memcpy(data, other.data, data_length); } virtual ~CanMsg() { } From 8ffd335132add989d720d1237d09aff0bee06c1c Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Mon, 6 Nov 2023 07:34:42 +0000 Subject: [PATCH 47/61] Fix brace style and indent --- api/CanMsg.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index cae7cc10..3e103c0b 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -51,11 +51,12 @@ class CanMsg : public Printable CanMsg() : CanMsg(0, 0, nullptr) { } - CanMsg(CanMsg const & other) { - id = other.id; - data_length = other.data_length; - if (data_length > 0) - memcpy(data, other.data, data_length); + CanMsg(CanMsg const & other) + { + id = other.id; + data_length = other.data_length; + if (data_length > 0) + memcpy(data, other.data, data_length); } virtual ~CanMsg() { } From cb3ab4c90d71d40c9c3f5a37bac0c274e8c89cbb Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 31 Oct 2023 12:13:48 +0100 Subject: [PATCH 48/61] Add String::isEmpty() --- api/String.h | 1 + 1 file changed, 1 insertion(+) diff --git a/api/String.h b/api/String.h index 73a872de..0bafd35a 100644 --- a/api/String.h +++ b/api/String.h @@ -89,6 +89,7 @@ class String // invalid string (i.e., "if (s)" will be true afterwards) bool reserve(unsigned int size); inline unsigned int length(void) const {return len;} + inline bool isEmpty(void) const { return length() == 0; } // creates a copy of the assigned value. if the value is null or // invalid, or if the memory allocation fails, the string will be From 73e2d09d7d9d11b81071e70745a539a412a226f4 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 7 Nov 2023 18:20:31 +0100 Subject: [PATCH 49/61] Add unit test for String::isEmpty() --- test/src/String/test_isEmpty.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/src/String/test_isEmpty.cpp diff --git a/test/src/String/test_isEmpty.cpp b/test/src/String/test_isEmpty.cpp new file mode 100644 index 00000000..9f70f26d --- /dev/null +++ b/test/src/String/test_isEmpty.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Arduino. All rights reserved. + */ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +#include + +#include "StringPrinter.h" + +/************************************************************************************** + * TEST CODE + **************************************************************************************/ + +TEST_CASE ("Testing String::isEmpty when string is empty", "[String-isEmpty-01]") +{ + arduino::String str; + REQUIRE(str.isEmpty()); +} + +TEST_CASE ("Testing String::isEmpty when string contains characters", "[String-isEmpty-02]") +{ + arduino::String str("Testing String::isEmpty"); + REQUIRE(!str.isEmpty()); +} From 0ef90b49fa2d66cba8a0980f443f2bc3d0e28fde Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Mon, 20 Nov 2023 14:58:04 +0100 Subject: [PATCH 50/61] making type function callable when IPAddress is defined const --- api/IPAddress.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/IPAddress.h b/api/IPAddress.h index 28dde3be..31a2d06d 100644 --- a/api/IPAddress.h +++ b/api/IPAddress.h @@ -98,7 +98,7 @@ class IPAddress : public Printable { virtual size_t printTo(Print& p) const; String toString() const; - IPType type() { return _type; } + IPType type() const { return _type; } friend class UDP; friend class Client; From e6d53c6c061c956f15e0e7375e4e531cc97b2f26 Mon Sep 17 00:00:00 2001 From: Leonhard Seidel Date: Sun, 26 Nov 2023 15:21:14 +0100 Subject: [PATCH 51/61] Update pgmspace.h Some macros were missing from the compatibility header --- api/deprecated-avr-comp/avr/pgmspace.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/deprecated-avr-comp/avr/pgmspace.h b/api/deprecated-avr-comp/avr/pgmspace.h index 95897d75..a80e4a51 100644 --- a/api/deprecated-avr-comp/avr/pgmspace.h +++ b/api/deprecated-avr-comp/avr/pgmspace.h @@ -30,7 +30,9 @@ #include #define PROGMEM +#define __ATTR_PROGMEM__ #define PGM_P const char * +#define PGM_VOID_P const void * #define PSTR(str) (str) #define _SFR_BYTE(n) (n) From 0c853c5cded2768122fae258d42b2b4c06cdb3b1 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 23 Jan 2024 09:29:32 +0100 Subject: [PATCH 52/61] Release v1.5.0 --- api/ArduinoAPI.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ArduinoAPI.h b/api/ArduinoAPI.h index c1ce5d2d..eae69497 100644 --- a/api/ArduinoAPI.h +++ b/api/ArduinoAPI.h @@ -20,8 +20,8 @@ #ifndef ARDUINO_API_H #define ARDUINO_API_H -// version 1.4.2 -#define ARDUINO_API_VERSION 10402 +// version 1.5.0 +#define ARDUINO_API_VERSION 10500 #include "Binary.h" From 4c7bc29d14adfca52a1fbfef29e8f02541609f26 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 30 Apr 2024 16:30:02 +0200 Subject: [PATCH 53/61] api: Add DMAPool. The DMAPool class allocates and manages a pool of buffers that are DMA and cache friendly, designed for applications that require frequent buffer exchanges between the CPU and DMA (such as audio applications). The DMAPool maintains a read and write queues of DMA buffers. DMA buffers' sizes are rounded up to a multiple of the pool's alignment (which defaults to cache line size on platforms with caches), and their memory is initialized from one contiguous memory block. A typical usage of DMAPool involves allocating a DMA buffer from the write queue for writing by a producer, updating its contents, and then releasing it. When released, the DMA buffer returns to the pool, which in turn places it back into the read queue for later consumption by the consumer. For example: ```C++ // Writer/Producer side (For example, an IRQ handler). DMABuffer *buf = pool->alloc(DMA_BUFFER_WRITE); for (size_t i=0; irelease(); // Reader/Consumer side (User/library). DMABuffer *buf = pool->alloc(DMA_BUFFER_READ); for (size_t i=0; irelease(); ``` Note that the DMAPool uses single-writer, single-reader lock-free queues to store buffers, and as such, it can only be used by a single reader and a single writer. Locks are avoided to allow the DMAPool to be used from an ISR producer/consumer, with only the main thread, and without disabling IRQs. Signed-off-by: iabdalkader --- api/DMAPool.h | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 api/DMAPool.h diff --git a/api/DMAPool.h b/api/DMAPool.h new file mode 100644 index 00000000..398b49d3 --- /dev/null +++ b/api/DMAPool.h @@ -0,0 +1,315 @@ +/* + This file is part of the Arduino_AdvancedAnalog library. + Copyright (c) 2023-2024 Arduino SA. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef __DMA_POOL_H__ +#define __DMA_POOL_H__ + +#include + +namespace arduino { + +#if defined(__DCACHE_PRESENT) +#define __CACHE_LINE_SIZE__ __SCB_DCACHE_LINE_SIZE +#elif defined(__cpp_lib_hardware_interference_size) +#define __CACHE_LINE_SIZE__ std::hardware_constructive_interference_size +#else // No cache. +#define __CACHE_LINE_SIZE__ alignof(int) +#endif + +// Single-producer, single-consumer, lock-free bounded Queue. +template class SPSCQueue { + private: + size_t capacity; + std::atomic head; + std::atomic tail; + std::unique_ptr buff; + + public: + SPSCQueue(size_t size=0): + capacity(0), tail(0), head(0), buff(nullptr) { + if (size) { + T *mem = new T[size + 1]; + if (mem) { + buff.reset(mem); + capacity = size + 1; + } + } + } + + void reset() { + tail = head = 0; + } + + size_t empty() { + return tail == head; + } + + operator bool() const { + return buff.get() != nullptr; + } + + bool push(T data) { + size_t curr = head.load(std::memory_order_relaxed); + size_t next = (curr + 1) % capacity; + if (!buff || (next == tail.load(std::memory_order_acquire))) { + return false; + } + buff[curr] = data; + head.store(next, std::memory_order_release); + return true; + } + + T pop(bool peek=false) { + size_t curr = tail.load(std::memory_order_relaxed); + if (!buff || (curr == head.load(std::memory_order_acquire))) { + return nullptr; + } + T data = buff[curr]; + if (!peek) { + size_t next = (curr + 1) % capacity; + tail.store(next, std::memory_order_release); + } + return data; + } +}; + +enum { + DMA_BUFFER_READ = (1 << 0), + DMA_BUFFER_WRITE = (1 << 1), + DMA_BUFFER_DISCONT = (1 << 2), + DMA_BUFFER_INTRLVD = (1 << 3), +} DMABufferFlags; + +// Forward declaration of DMAPool class. +template class DMAPool; + +template class DMABuffer { + private: + DMAPool *pool; + size_t n_samples; + size_t n_channels; + T *ptr; + uint32_t ts; + uint32_t flags; + + public: + DMABuffer(DMAPool *pool=nullptr, size_t samples=0, size_t channels=0, T *mem=nullptr): + pool(pool), n_samples(samples), n_channels(channels), ptr(mem), ts(0), flags(0) { + } + + T *data() { + return ptr; + } + + size_t size() { + return n_samples * n_channels; + } + + size_t bytes() { + return n_samples * n_channels * sizeof(T); + } + + void flush() { + #if __DCACHE_PRESENT + if (ptr) { + SCB_CleanDCache_by_Addr(data(), bytes()); + } + #endif + } + + void invalidate() { + #if __DCACHE_PRESENT + if (ptr) { + SCB_InvalidateDCache_by_Addr(data(), bytes()); + } + #endif + } + + uint32_t timestamp() { + return ts; + } + + void timestamp(uint32_t ts) { + this->ts = ts; + } + + uint32_t channels() { + return n_channels; + } + + void release() { + if (pool && ptr) { + pool->free(this, flags); + } + } + + void set_flags(uint32_t f) { + flags |= f; + } + + bool get_flags(uint32_t f=0xFFFFFFFFU) { + return flags & f; + } + + void clr_flags(uint32_t f=0xFFFFFFFFU) { + flags &= (~f); + } + + T& operator[](size_t i) { + assert(ptr && i < size()); + return ptr[i]; + } + + const T& operator[](size_t i) const { + assert(ptr && i < size()); + return ptr[i]; + } + + operator bool() const { + return (ptr != nullptr); + } +}; + +template class DMAPool { + private: + uint8_t *mem; + bool managed; + SPSCQueue*> wqueue; + SPSCQueue*> rqueue; + + // Allocates dynamic aligned memory. + // Note this memory must be free'd with aligned_free. + static void *aligned_malloc(size_t size) { + void **ptr, *stashed; + size_t offset = A - 1 + sizeof(void *); + if ((A % 2) || !((stashed = ::malloc(size + offset)))) { + return nullptr; + } + ptr = (void **) (((uintptr_t) stashed + offset) & ~(A - 1)); + ptr[-1] = stashed; + return ptr; + } + + // Frees dynamic aligned memory allocated with aligned_malloc. + static void aligned_free(void *ptr) { + if (ptr != nullptr) { + ::free(((void **) ptr)[-1]); + } + } + + public: + DMAPool(size_t n_samples, size_t n_channels, size_t n_buffers, void *mem_in=nullptr): + mem((uint8_t *) mem_in), managed(mem_in==nullptr), wqueue(n_buffers), rqueue(n_buffers) { + // Round up to the next multiple of the alignment. + size_t bufsize = (((n_samples * n_channels * sizeof(T)) + (A-1)) & ~(A-1)); + if (bufsize && rqueue && wqueue) { + if (mem == nullptr) { + // Allocate an aligned memory block for the DMA buffers' memory. + mem = (uint8_t *) aligned_malloc(n_buffers * bufsize); + if (!mem) { + // Failed to allocate memory. + return; + } + } + // Allocate the DMA buffers, initialize them using aligned + // pointers from the pool, and add them to the write queue. + for (size_t i=0; i *buf = new DMABuffer( + this, n_samples, n_channels, (T *) &mem[i * bufsize] + ); + if (buf == nullptr) { + break; + } + wqueue.push(buf); + } + } + } + + ~DMAPool() { + while (readable()) { + delete alloc(DMA_BUFFER_READ); + } + + while (writable()) { + delete alloc(DMA_BUFFER_WRITE); + } + + if (mem && managed) { + aligned_free(mem); + } + } + + bool writable() { + return !(wqueue.empty()); + } + + bool readable() { + return !(rqueue.empty()); + } + + void flush() { + while (readable()) { + DMABuffer *buf = alloc(DMA_BUFFER_READ); + if (buf) { + buf->release(); + } + } + } + + DMABuffer *alloc(uint32_t flags) { + DMABuffer *buf = nullptr; + if (flags & DMA_BUFFER_READ) { + // Get a DMA buffer from the read/ready queue. + buf = rqueue.pop(); + } else { + // Get a DMA buffer from the write/free queue. + buf = wqueue.pop(); + } + if (buf) { + buf->clr_flags(DMA_BUFFER_READ | DMA_BUFFER_WRITE); + buf->set_flags(flags); + } + return buf; + } + + void free(DMABuffer *buf, uint32_t flags=0) { + if (buf == nullptr) { + return; + } + if (flags == 0) { + flags = buf->get_flags(); + } + if (flags & DMA_BUFFER_READ) { + // Return the DMA buffer to the write/free queue. + buf->clr_flags(); + wqueue.push(buf); + } else { + // Return the DMA buffer to the read/ready queue. + rqueue.push(buf); + } + } + +}; + +} // namespace arduino + +using arduino::DMAPool; +using arduino::DMABuffer; +using arduino::SPSCQueue; +#endif //__DMA_POOL_H__ From 9a4bb9ad878e80bc4706de38095a06291d6e18b9 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 6 May 2024 14:49:26 +0200 Subject: [PATCH 54/61] api/DMAPool: Add missing header for unique ptr. Signed-off-by: iabdalkader --- api/DMAPool.h | 1 + 1 file changed, 1 insertion(+) diff --git a/api/DMAPool.h b/api/DMAPool.h index 398b49d3..815f5d3e 100644 --- a/api/DMAPool.h +++ b/api/DMAPool.h @@ -21,6 +21,7 @@ #define __DMA_POOL_H__ #include +#include namespace arduino { From 331cdd9ad216941cc2dedefa51fe643d1c4f0ac2 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 13 May 2024 17:05:48 +0200 Subject: [PATCH 55/61] Release v1.5.1 --- api/ArduinoAPI.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ArduinoAPI.h b/api/ArduinoAPI.h index eae69497..ce06e881 100644 --- a/api/ArduinoAPI.h +++ b/api/ArduinoAPI.h @@ -20,8 +20,8 @@ #ifndef ARDUINO_API_H #define ARDUINO_API_H -// version 1.5.0 -#define ARDUINO_API_VERSION 10500 +// version 1.5.1 +#define ARDUINO_API_VERSION 10501 #include "Binary.h" From a1f668db6d77f1032eabeae2c3d15055e3e9ff2a Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 28 May 2024 11:31:33 +0200 Subject: [PATCH 56/61] license: add missing license headers Some of the files in the Arduino core were missing the license headers. They contain code which is either copied from previous Arduino cores (which were already LGPL-2.1-or-later), or has been submitted to this repository where most of the code is clearly LGPL-2.1-or-later. In any case, all the contributors have either been directly employed by Arduino or have signed the CLA. Add the missing LGPL-2.1-or-later headers to the files. --- api/Common.cpp | 19 +++++++++++++++++++ api/Common.h | 19 +++++++++++++++++++ api/Compat.h | 19 +++++++++++++++++++ api/Interrupts.h | 19 +++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/api/Common.cpp b/api/Common.cpp index d1f822c9..8299247a 100644 --- a/api/Common.cpp +++ b/api/Common.cpp @@ -1,3 +1,22 @@ +/* + Common.cpp - Common function implementations + Copyright (c) 2017 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + #include "Common.h" /* C++ prototypes */ diff --git a/api/Common.h b/api/Common.h index 44fe95e8..9b28f40a 100644 --- a/api/Common.h +++ b/api/Common.h @@ -1,3 +1,22 @@ +/* + Common.h - Common definitions for Arduino core + Copyright (c) 2017 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + #pragma once #include #include diff --git a/api/Compat.h b/api/Compat.h index 725ccd66..564170c6 100644 --- a/api/Compat.h +++ b/api/Compat.h @@ -1,3 +1,22 @@ +/* + Compat.h - Compatibility layer for Arduino API + Copyright (c) 2018 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + #ifndef __COMPAT_H__ #define __COMPAT_H__ diff --git a/api/Interrupts.h b/api/Interrupts.h index e306fc79..c3e37ade 100644 --- a/api/Interrupts.h +++ b/api/Interrupts.h @@ -1,3 +1,22 @@ +/* + Interrupts.h - Arduino interrupt management functions + Copyright (c) 2018 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + #ifndef W_INTERRUPTS_CPP #define W_INTERRUPTS_CPP #ifdef __cplusplus From a2735c07a5eec0fb3ba967c0b62282b4901d2ff9 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 28 May 2024 11:28:04 +0200 Subject: [PATCH 57/61] license: update CAN files license to LGPL-2.1-or-later The CAN files had a non-standard license which does not match the other files in the repository. This commit updates the license header to match that of the other files. All of the contributors to these files have either been employed by Arduino or have signed the CLA. --- api/CanMsg.cpp | 22 +++++++++++++++++----- api/CanMsg.h | 22 +++++++++++++++++----- api/CanMsgRingbuffer.cpp | 22 +++++++++++++++++----- api/CanMsgRingbuffer.h | 22 +++++++++++++++++----- api/HardwareCAN.h | 22 +++++++++++++++++----- 5 files changed, 85 insertions(+), 25 deletions(-) diff --git a/api/CanMsg.cpp b/api/CanMsg.cpp index 1137f066..f4f93ce8 100644 --- a/api/CanMsg.cpp +++ b/api/CanMsg.cpp @@ -1,9 +1,21 @@ /* - * This file is free software; you can redistribute it and/or modify - * it under the terms of either the GNU General Public License version 2 - * or the GNU Lesser General Public License version 2.1, both as - * published by the Free Software Foundation. - */ + CanMsg.cpp - Library for CAN message handling + Copyright (c) 2023 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /************************************************************************************** * INCLUDE diff --git a/api/CanMsg.h b/api/CanMsg.h index 3e103c0b..a8e32e5b 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -1,9 +1,21 @@ /* - * This file is free software; you can redistribute it and/or modify - * it under the terms of either the GNU General Public License version 2 - * or the GNU Lesser General Public License version 2.1, both as - * published by the Free Software Foundation. - */ + CanMsg.h - Library for CAN message handling + Copyright (c) 2023 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #ifndef ARDUINOCORE_API_CAN_MSG_H_ #define ARDUINOCORE_API_CAN_MSG_H_ diff --git a/api/CanMsgRingbuffer.cpp b/api/CanMsgRingbuffer.cpp index e62db89a..56abbac4 100644 --- a/api/CanMsgRingbuffer.cpp +++ b/api/CanMsgRingbuffer.cpp @@ -1,9 +1,21 @@ /* - * This file is free software; you can redistribute it and/or modify - * it under the terms of either the GNU General Public License version 2 - * or the GNU Lesser General Public License version 2.1, both as - * published by the Free Software Foundation. - */ + CanMsgRingbuffer.cpp - Library for CAN message handling + Copyright (c) 2023 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /************************************************************************************** * INCLUDE diff --git a/api/CanMsgRingbuffer.h b/api/CanMsgRingbuffer.h index 461df450..9eb6bafc 100644 --- a/api/CanMsgRingbuffer.h +++ b/api/CanMsgRingbuffer.h @@ -1,9 +1,21 @@ /* - * This file is free software; you can redistribute it and/or modify - * it under the terms of either the GNU General Public License version 2 - * or the GNU Lesser General Public License version 2.1, both as - * published by the Free Software Foundation. - */ + CanMsgRingbuffer.h - Library for CAN message handling + Copyright (c) 2023 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #ifndef ARDUINOCORE_API_CAN_MSG_RING_BUFFER_H_ #define ARDUINOCORE_API_CAN_MSG_RING_BUFFER_H_ diff --git a/api/HardwareCAN.h b/api/HardwareCAN.h index a5b87604..57d9d582 100644 --- a/api/HardwareCAN.h +++ b/api/HardwareCAN.h @@ -1,9 +1,21 @@ /* - * This file is free software; you can redistribute it and/or modify - * it under the terms of either the GNU General Public License version 2 - * or the GNU Lesser General Public License version 2.1, both as - * published by the Free Software Foundation. - */ + HardwareCAN.h - CAN bus interface for Arduino core + Copyright (c) 2023 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #ifndef ARDUINOCORE_API_HARDWARECAN_H #define ARDUINOCORE_API_HARDWARECAN_H From eeb0ce3f33c1fc9b0890c76532c8a0100cdc274d Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 28 May 2024 11:39:23 +0200 Subject: [PATCH 58/61] license: cosmetic updates Minor updates to the license headers to make them more consistent among the repository. --- api/ArduinoAPI.h | 2 +- api/HardwareI2C.h | 5 +++-- api/HardwareSPI.h | 5 +++-- api/HardwareSerial.h | 5 +++-- api/Print.cpp | 5 +++-- api/Print.h | 5 +++-- api/Printable.h | 5 +++-- api/RingBuffer.h | 5 +++-- api/itoa.h | 5 +++-- 9 files changed, 25 insertions(+), 17 deletions(-) diff --git a/api/ArduinoAPI.h b/api/ArduinoAPI.h index ce06e881..3d53085b 100644 --- a/api/ArduinoAPI.h +++ b/api/ArduinoAPI.h @@ -9,7 +9,7 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public diff --git a/api/HardwareI2C.h b/api/HardwareI2C.h index 4a8e5f98..98c6bfd7 100644 --- a/api/HardwareI2C.h +++ b/api/HardwareI2C.h @@ -1,4 +1,5 @@ /* + HardwareI2C.h - Hardware I2C interface for Arduino Copyright (c) 2016 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/HardwareSPI.h b/api/HardwareSPI.h index 8b8affd0..7f6aea2b 100644 --- a/api/HardwareSPI.h +++ b/api/HardwareSPI.h @@ -1,4 +1,5 @@ /* + HardwareSPI.h - Hardware SPI interface for Arduino Copyright (c) 2018 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/HardwareSerial.h b/api/HardwareSerial.h index e8f0657a..b687cdf1 100644 --- a/api/HardwareSerial.h +++ b/api/HardwareSerial.h @@ -1,4 +1,5 @@ /* + HardwareSerial.h - Hardware serial interface for Arduino Copyright (c) 2016 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/Print.cpp b/api/Print.cpp index f1e82469..4a6e942a 100644 --- a/api/Print.cpp +++ b/api/Print.cpp @@ -1,4 +1,5 @@ /* + Print.cpp - Base class that provides print() and println() Copyright (c) 2014 Arduino. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/Print.h b/api/Print.h index 5a19fe78..2016d7d5 100644 --- a/api/Print.h +++ b/api/Print.h @@ -1,4 +1,5 @@ /* + Print.h - Base class that provides print() and println() Copyright (c) 2016 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/Printable.h b/api/Printable.h index 972866e8..850c8d21 100644 --- a/api/Printable.h +++ b/api/Printable.h @@ -1,4 +1,5 @@ /* + Printable.h - Interface for classes that can be printed via Print Copyright (c) 2016 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/RingBuffer.h b/api/RingBuffer.h index 8665cf6a..b69c20d4 100644 --- a/api/RingBuffer.h +++ b/api/RingBuffer.h @@ -1,4 +1,5 @@ /* + RingBuffer.h - Ring buffer implementation Copyright (c) 2014 Arduino. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software diff --git a/api/itoa.h b/api/itoa.h index 55b28493..c2077833 100644 --- a/api/itoa.h +++ b/api/itoa.h @@ -1,4 +1,5 @@ /* + itoa.h - Integer to ASCII conversion Copyright (c) 2016 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or @@ -8,8 +9,8 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software From 25be1ac579fc7ea48d8a51521884482383931e40 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 28 May 2024 11:58:31 +0200 Subject: [PATCH 59/61] license: add SPDX-License-Identifier to all files in test/ The files in the test/ folder had a copyright notice, but no license information. This commit adds the LGPL-2.1-or-later SPDX license identifier to all these files. --- test/CMakeLists.txt | 2 ++ test/include/MillisFake.h | 2 ++ test/include/PrintMock.h | 2 ++ test/include/PrintableMock.h | 2 ++ test/include/StreamMock.h | 2 ++ test/src/CanMsg/test_CanExtendedId.cpp | 2 ++ test/src/CanMsg/test_CanMsg.cpp | 2 ++ test/src/CanMsg/test_CanMsg_CopyCtor.cpp | 2 ++ test/src/CanMsg/test_CanStandardId.cpp | 2 ++ test/src/CanMsg/test_isExtendedId.cpp | 2 ++ test/src/CanMsg/test_isStandardId.cpp | 2 ++ test/src/CanMsg/test_operator_assignment.cpp | 2 ++ test/src/CanMsg/test_printTo.cpp | 2 ++ test/src/CanMsgRingbuffer/test_available.cpp | 2 ++ test/src/Common/test_makeWord.cpp | 2 ++ test/src/Common/test_map.cpp | 2 ++ test/src/Common/test_max.cpp | 2 ++ test/src/Common/test_min.cpp | 2 ++ test/src/IPAddress/test_IPAddress.cpp | 2 ++ test/src/IPAddress/test_IPAddress6.cpp | 2 ++ test/src/IPAddress/test_fromString.cpp | 2 ++ test/src/IPAddress/test_fromString6.cpp | 2 ++ test/src/IPAddress/test_operator_assignment.cpp | 2 ++ test/src/IPAddress/test_operator_comparison.cpp | 2 ++ test/src/IPAddress/test_operator_comparison6.cpp | 2 ++ test/src/IPAddress/test_operator_parentheses.cpp | 2 ++ test/src/IPAddress/test_operator_parentheses6.cpp | 2 ++ test/src/IPAddress/test_printTo.cpp | 2 ++ test/src/IPAddress/test_printTo6.cpp | 2 ++ test/src/IPAddress/test_toString.cpp | 2 ++ test/src/MillisFake.cpp | 2 ++ test/src/Print/test_availableForWrite.cpp | 2 ++ test/src/Print/test_clearWriteError.cpp | 2 ++ test/src/Print/test_getWriteError.cpp | 2 ++ test/src/Print/test_print.cpp | 2 ++ test/src/Print/test_println.cpp | 2 ++ test/src/PrintMock.cpp | 2 ++ test/src/Ringbuffer/test_available.cpp | 2 ++ test/src/Ringbuffer/test_availableForStore.cpp | 2 ++ test/src/Ringbuffer/test_clear.cpp | 2 ++ test/src/Ringbuffer/test_isFull.cpp | 2 ++ test/src/Ringbuffer/test_peek.cpp | 2 ++ test/src/Ringbuffer/test_read_char.cpp | 2 ++ test/src/Ringbuffer/test_store_char.cpp | 2 ++ test/src/Stream/test_find.cpp | 2 ++ test/src/Stream/test_findUntil.cpp | 2 ++ test/src/Stream/test_getTimeout.cpp | 2 ++ test/src/Stream/test_parseFloat.cpp | 2 ++ test/src/Stream/test_parseInt.cpp | 2 ++ test/src/Stream/test_readBytes.cpp | 2 ++ test/src/Stream/test_readBytesUntil.cpp | 2 ++ test/src/Stream/test_readString.cpp | 2 ++ test/src/Stream/test_readStringUntil.cpp | 2 ++ test/src/Stream/test_setTimeout.cpp | 2 ++ test/src/StreamMock.cpp | 2 ++ test/src/String/StringPrinter.h | 6 ++++++ test/src/String/test_String.cpp | 2 ++ test/src/String/test_characterAccessFunc.cpp | 2 ++ test/src/String/test_compareTo.cpp | 2 ++ test/src/String/test_comparisonFunc.cpp | 2 ++ test/src/String/test_concat.cpp | 2 ++ test/src/String/test_indexOf.cpp | 2 ++ test/src/String/test_isEmpty.cpp | 2 ++ test/src/String/test_lastIndexOf.cpp | 2 ++ test/src/String/test_length.cpp | 2 ++ test/src/String/test_move.cpp | 6 ++++++ test/src/String/test_operators.cpp | 2 ++ test/src/String/test_remove.cpp | 2 ++ test/src/String/test_replace.cpp | 2 ++ test/src/String/test_substring.cpp | 2 ++ test/src/String/test_toDouble.cpp | 2 ++ test/src/String/test_toFloat.cpp | 2 ++ test/src/String/test_toInt.cpp | 2 ++ test/src/String/test_toLowerCase.cpp | 2 ++ test/src/String/test_toUpperCase.cpp | 2 ++ test/src/String/test_trim.cpp | 2 ++ test/src/WCharacter/test_isAscii.cpp | 2 ++ test/src/WCharacter/test_isControl.cpp | 2 ++ test/src/WCharacter/test_isDigit.cpp | 2 ++ test/src/WCharacter/test_isHexadecimalDigit.cpp | 2 ++ test/src/WCharacter/test_isLowerCase.cpp | 2 ++ test/src/WCharacter/test_isPunct.cpp | 2 ++ test/src/WCharacter/test_isSpace.cpp | 2 ++ test/src/WCharacter/test_isUpperCase.cpp | 2 ++ test/src/WCharacter/test_isWhitespace.cpp | 2 ++ test/src/WCharacter/test_toAscii.cpp | 2 ++ test/src/dtostrf.cpp | 2 ++ test/src/itoa.cpp | 2 ++ test/src/main.cpp | 2 ++ 89 files changed, 186 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f6bcc123..31b75483 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + ########################################################################## cmake_minimum_required(VERSION 2.8) diff --git a/test/include/MillisFake.h b/test/include/MillisFake.h index be078bd0..bdb3f14c 100644 --- a/test/include/MillisFake.h +++ b/test/include/MillisFake.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef MILLIS_FAKE_H_ diff --git a/test/include/PrintMock.h b/test/include/PrintMock.h index d41e78fa..9a103848 100644 --- a/test/include/PrintMock.h +++ b/test/include/PrintMock.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef PRINT_MOCK_H_ diff --git a/test/include/PrintableMock.h b/test/include/PrintableMock.h index 39121928..f55540d1 100644 --- a/test/include/PrintableMock.h +++ b/test/include/PrintableMock.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef PRINTABLE_MOCK_H_ diff --git a/test/include/StreamMock.h b/test/include/StreamMock.h index a7d9da1a..afa4b487 100644 --- a/test/include/StreamMock.h +++ b/test/include/StreamMock.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef STREAM_MOCK_H_ diff --git a/test/src/CanMsg/test_CanExtendedId.cpp b/test/src/CanMsg/test_CanExtendedId.cpp index a812f08b..0377a40a 100644 --- a/test/src/CanMsg/test_CanExtendedId.cpp +++ b/test/src/CanMsg/test_CanExtendedId.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_CanMsg.cpp b/test/src/CanMsg/test_CanMsg.cpp index 03704623..f132e84a 100644 --- a/test/src/CanMsg/test_CanMsg.cpp +++ b/test/src/CanMsg/test_CanMsg.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp index ccf62931..9c4ee4e1 100644 --- a/test/src/CanMsg/test_CanMsg_CopyCtor.cpp +++ b/test/src/CanMsg/test_CanMsg_CopyCtor.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_CanStandardId.cpp b/test/src/CanMsg/test_CanStandardId.cpp index 81d2301d..28fc3373 100644 --- a/test/src/CanMsg/test_CanStandardId.cpp +++ b/test/src/CanMsg/test_CanStandardId.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_isExtendedId.cpp b/test/src/CanMsg/test_isExtendedId.cpp index 242866e9..ff309d9c 100644 --- a/test/src/CanMsg/test_isExtendedId.cpp +++ b/test/src/CanMsg/test_isExtendedId.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_isStandardId.cpp b/test/src/CanMsg/test_isStandardId.cpp index a73bf7c1..36789d07 100644 --- a/test/src/CanMsg/test_isStandardId.cpp +++ b/test/src/CanMsg/test_isStandardId.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_operator_assignment.cpp b/test/src/CanMsg/test_operator_assignment.cpp index 0dd35543..a2f56457 100644 --- a/test/src/CanMsg/test_operator_assignment.cpp +++ b/test/src/CanMsg/test_operator_assignment.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsg/test_printTo.cpp b/test/src/CanMsg/test_printTo.cpp index bf532c81..53e9e059 100644 --- a/test/src/CanMsg/test_printTo.cpp +++ b/test/src/CanMsg/test_printTo.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/CanMsgRingbuffer/test_available.cpp b/test/src/CanMsgRingbuffer/test_available.cpp index 684eaeec..9a3b55cd 100644 --- a/test/src/CanMsgRingbuffer/test_available.cpp +++ b/test/src/CanMsgRingbuffer/test_available.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Common/test_makeWord.cpp b/test/src/Common/test_makeWord.cpp index dcb3ea33..55ca55ec 100644 --- a/test/src/Common/test_makeWord.cpp +++ b/test/src/Common/test_makeWord.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Common/test_map.cpp b/test/src/Common/test_map.cpp index 59441cac..c1ccde28 100644 --- a/test/src/Common/test_map.cpp +++ b/test/src/Common/test_map.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Common/test_max.cpp b/test/src/Common/test_max.cpp index ccb5e5e1..bff6830c 100644 --- a/test/src/Common/test_max.cpp +++ b/test/src/Common/test_max.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Common/test_min.cpp b/test/src/Common/test_min.cpp index 750f41ae..dcb24b81 100644 --- a/test/src/Common/test_min.cpp +++ b/test/src/Common/test_min.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_IPAddress.cpp b/test/src/IPAddress/test_IPAddress.cpp index 6b66e118..67aea868 100644 --- a/test/src/IPAddress/test_IPAddress.cpp +++ b/test/src/IPAddress/test_IPAddress.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_IPAddress6.cpp b/test/src/IPAddress/test_IPAddress6.cpp index 3a8a5315..c6351300 100644 --- a/test/src/IPAddress/test_IPAddress6.cpp +++ b/test/src/IPAddress/test_IPAddress6.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_fromString.cpp b/test/src/IPAddress/test_fromString.cpp index d058b529..be44c8c2 100644 --- a/test/src/IPAddress/test_fromString.cpp +++ b/test/src/IPAddress/test_fromString.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_fromString6.cpp b/test/src/IPAddress/test_fromString6.cpp index deb54458..61fa1402 100644 --- a/test/src/IPAddress/test_fromString6.cpp +++ b/test/src/IPAddress/test_fromString6.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_operator_assignment.cpp b/test/src/IPAddress/test_operator_assignment.cpp index fdf641d4..1d7431f6 100644 --- a/test/src/IPAddress/test_operator_assignment.cpp +++ b/test/src/IPAddress/test_operator_assignment.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_operator_comparison.cpp b/test/src/IPAddress/test_operator_comparison.cpp index 3978c8e2..c36a0112 100644 --- a/test/src/IPAddress/test_operator_comparison.cpp +++ b/test/src/IPAddress/test_operator_comparison.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_operator_comparison6.cpp b/test/src/IPAddress/test_operator_comparison6.cpp index da03a0b3..c584a232 100644 --- a/test/src/IPAddress/test_operator_comparison6.cpp +++ b/test/src/IPAddress/test_operator_comparison6.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_operator_parentheses.cpp b/test/src/IPAddress/test_operator_parentheses.cpp index c1c2e375..c58212f3 100644 --- a/test/src/IPAddress/test_operator_parentheses.cpp +++ b/test/src/IPAddress/test_operator_parentheses.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_operator_parentheses6.cpp b/test/src/IPAddress/test_operator_parentheses6.cpp index b4575f4e..375d1492 100644 --- a/test/src/IPAddress/test_operator_parentheses6.cpp +++ b/test/src/IPAddress/test_operator_parentheses6.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_printTo.cpp b/test/src/IPAddress/test_printTo.cpp index a0ed7c16..2a6d129a 100644 --- a/test/src/IPAddress/test_printTo.cpp +++ b/test/src/IPAddress/test_printTo.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_printTo6.cpp b/test/src/IPAddress/test_printTo6.cpp index 7d924b63..8bee2efe 100644 --- a/test/src/IPAddress/test_printTo6.cpp +++ b/test/src/IPAddress/test_printTo6.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/IPAddress/test_toString.cpp b/test/src/IPAddress/test_toString.cpp index f36ae549..f33f065e 100644 --- a/test/src/IPAddress/test_toString.cpp +++ b/test/src/IPAddress/test_toString.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/MillisFake.cpp b/test/src/MillisFake.cpp index b7ac98e2..293af87f 100644 --- a/test/src/MillisFake.cpp +++ b/test/src/MillisFake.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Print/test_availableForWrite.cpp b/test/src/Print/test_availableForWrite.cpp index c5dfbcda..dc989d2c 100644 --- a/test/src/Print/test_availableForWrite.cpp +++ b/test/src/Print/test_availableForWrite.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Print/test_clearWriteError.cpp b/test/src/Print/test_clearWriteError.cpp index 720a1210..7fdf992e 100644 --- a/test/src/Print/test_clearWriteError.cpp +++ b/test/src/Print/test_clearWriteError.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Print/test_getWriteError.cpp b/test/src/Print/test_getWriteError.cpp index 3b616411..7d567042 100644 --- a/test/src/Print/test_getWriteError.cpp +++ b/test/src/Print/test_getWriteError.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Print/test_print.cpp b/test/src/Print/test_print.cpp index 2598b7f7..2cf4e911 100644 --- a/test/src/Print/test_print.cpp +++ b/test/src/Print/test_print.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Print/test_println.cpp b/test/src/Print/test_println.cpp index 2d2d7306..d6c03753 100644 --- a/test/src/Print/test_println.cpp +++ b/test/src/Print/test_println.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/PrintMock.cpp b/test/src/PrintMock.cpp index a64031e1..ffa7c58f 100644 --- a/test/src/PrintMock.cpp +++ b/test/src/PrintMock.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_available.cpp b/test/src/Ringbuffer/test_available.cpp index 75b86a7f..59787360 100644 --- a/test/src/Ringbuffer/test_available.cpp +++ b/test/src/Ringbuffer/test_available.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_availableForStore.cpp b/test/src/Ringbuffer/test_availableForStore.cpp index 5b8415f6..31127621 100644 --- a/test/src/Ringbuffer/test_availableForStore.cpp +++ b/test/src/Ringbuffer/test_availableForStore.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_clear.cpp b/test/src/Ringbuffer/test_clear.cpp index 93da03a2..2e9d8dd7 100644 --- a/test/src/Ringbuffer/test_clear.cpp +++ b/test/src/Ringbuffer/test_clear.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_isFull.cpp b/test/src/Ringbuffer/test_isFull.cpp index c575981e..a5c52129 100644 --- a/test/src/Ringbuffer/test_isFull.cpp +++ b/test/src/Ringbuffer/test_isFull.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_peek.cpp b/test/src/Ringbuffer/test_peek.cpp index 9efe28ea..7664f735 100644 --- a/test/src/Ringbuffer/test_peek.cpp +++ b/test/src/Ringbuffer/test_peek.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_read_char.cpp b/test/src/Ringbuffer/test_read_char.cpp index babc27df..e873d076 100644 --- a/test/src/Ringbuffer/test_read_char.cpp +++ b/test/src/Ringbuffer/test_read_char.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Ringbuffer/test_store_char.cpp b/test/src/Ringbuffer/test_store_char.cpp index 0becdc0f..82e1d7b1 100644 --- a/test/src/Ringbuffer/test_store_char.cpp +++ b/test/src/Ringbuffer/test_store_char.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_find.cpp b/test/src/Stream/test_find.cpp index c715d522..2dbbc34c 100644 --- a/test/src/Stream/test_find.cpp +++ b/test/src/Stream/test_find.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_findUntil.cpp b/test/src/Stream/test_findUntil.cpp index 2455ed82..72ca26a0 100644 --- a/test/src/Stream/test_findUntil.cpp +++ b/test/src/Stream/test_findUntil.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_getTimeout.cpp b/test/src/Stream/test_getTimeout.cpp index c4db2541..a7230635 100644 --- a/test/src/Stream/test_getTimeout.cpp +++ b/test/src/Stream/test_getTimeout.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_parseFloat.cpp b/test/src/Stream/test_parseFloat.cpp index a9fba616..aa78c978 100644 --- a/test/src/Stream/test_parseFloat.cpp +++ b/test/src/Stream/test_parseFloat.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_parseInt.cpp b/test/src/Stream/test_parseInt.cpp index c79ed447..8d79a2af 100644 --- a/test/src/Stream/test_parseInt.cpp +++ b/test/src/Stream/test_parseInt.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_readBytes.cpp b/test/src/Stream/test_readBytes.cpp index 65466cc8..4b636ccc 100644 --- a/test/src/Stream/test_readBytes.cpp +++ b/test/src/Stream/test_readBytes.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_readBytesUntil.cpp b/test/src/Stream/test_readBytesUntil.cpp index f8c6620e..2efc39c8 100644 --- a/test/src/Stream/test_readBytesUntil.cpp +++ b/test/src/Stream/test_readBytesUntil.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_readString.cpp b/test/src/Stream/test_readString.cpp index f58cb412..9004aee2 100644 --- a/test/src/Stream/test_readString.cpp +++ b/test/src/Stream/test_readString.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_readStringUntil.cpp b/test/src/Stream/test_readStringUntil.cpp index d8ab3473..a27b48cf 100644 --- a/test/src/Stream/test_readStringUntil.cpp +++ b/test/src/Stream/test_readStringUntil.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/Stream/test_setTimeout.cpp b/test/src/Stream/test_setTimeout.cpp index 500f49f0..d068f22b 100644 --- a/test/src/Stream/test_setTimeout.cpp +++ b/test/src/Stream/test_setTimeout.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/StreamMock.cpp b/test/src/StreamMock.cpp index 8ee18302..c1768859 100644 --- a/test/src/StreamMock.cpp +++ b/test/src/StreamMock.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/StringPrinter.h b/test/src/String/StringPrinter.h index 1ddee147..88c480bf 100644 --- a/test/src/String/StringPrinter.h +++ b/test/src/String/StringPrinter.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include diff --git a/test/src/String/test_String.cpp b/test/src/String/test_String.cpp index 6d1b8152..a773bb0e 100644 --- a/test/src/String/test_String.cpp +++ b/test/src/String/test_String.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_characterAccessFunc.cpp b/test/src/String/test_characterAccessFunc.cpp index 49d257af..e05b7487 100644 --- a/test/src/String/test_characterAccessFunc.cpp +++ b/test/src/String/test_characterAccessFunc.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_compareTo.cpp b/test/src/String/test_compareTo.cpp index 74a3da7b..afa7c9e6 100644 --- a/test/src/String/test_compareTo.cpp +++ b/test/src/String/test_compareTo.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_comparisonFunc.cpp b/test/src/String/test_comparisonFunc.cpp index 3b49bacc..09def716 100644 --- a/test/src/String/test_comparisonFunc.cpp +++ b/test/src/String/test_comparisonFunc.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_concat.cpp b/test/src/String/test_concat.cpp index ef6c6fa1..e3776955 100644 --- a/test/src/String/test_concat.cpp +++ b/test/src/String/test_concat.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_indexOf.cpp b/test/src/String/test_indexOf.cpp index 9f32a07e..e3cd6461 100644 --- a/test/src/String/test_indexOf.cpp +++ b/test/src/String/test_indexOf.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_isEmpty.cpp b/test/src/String/test_isEmpty.cpp index 9f70f26d..cc8bbdd3 100644 --- a/test/src/String/test_isEmpty.cpp +++ b/test/src/String/test_isEmpty.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2023 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_lastIndexOf.cpp b/test/src/String/test_lastIndexOf.cpp index 7f776fa6..aff48cf9 100644 --- a/test/src/String/test_lastIndexOf.cpp +++ b/test/src/String/test_lastIndexOf.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_length.cpp b/test/src/String/test_length.cpp index fae358fa..02d67843 100644 --- a/test/src/String/test_length.cpp +++ b/test/src/String/test_length.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_move.cpp b/test/src/String/test_move.cpp index a2529b50..ba2a0aba 100644 --- a/test/src/String/test_move.cpp +++ b/test/src/String/test_move.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include #include diff --git a/test/src/String/test_operators.cpp b/test/src/String/test_operators.cpp index 5a3b677c..26da455a 100644 --- a/test/src/String/test_operators.cpp +++ b/test/src/String/test_operators.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_remove.cpp b/test/src/String/test_remove.cpp index 17b8dabb..9209a055 100644 --- a/test/src/String/test_remove.cpp +++ b/test/src/String/test_remove.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_replace.cpp b/test/src/String/test_replace.cpp index cfcaead0..04fa45ca 100644 --- a/test/src/String/test_replace.cpp +++ b/test/src/String/test_replace.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_substring.cpp b/test/src/String/test_substring.cpp index bb05d439..db9828fb 100644 --- a/test/src/String/test_substring.cpp +++ b/test/src/String/test_substring.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_toDouble.cpp b/test/src/String/test_toDouble.cpp index af6960e9..4a7e5cf7 100644 --- a/test/src/String/test_toDouble.cpp +++ b/test/src/String/test_toDouble.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_toFloat.cpp b/test/src/String/test_toFloat.cpp index 75cf94b2..2cc637a1 100644 --- a/test/src/String/test_toFloat.cpp +++ b/test/src/String/test_toFloat.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_toInt.cpp b/test/src/String/test_toInt.cpp index 060fdd27..705f30b1 100644 --- a/test/src/String/test_toInt.cpp +++ b/test/src/String/test_toInt.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_toLowerCase.cpp b/test/src/String/test_toLowerCase.cpp index 9f6f7c9d..f7101182 100644 --- a/test/src/String/test_toLowerCase.cpp +++ b/test/src/String/test_toLowerCase.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_toUpperCase.cpp b/test/src/String/test_toUpperCase.cpp index 1bcf93fb..eb80c64c 100644 --- a/test/src/String/test_toUpperCase.cpp +++ b/test/src/String/test_toUpperCase.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/String/test_trim.cpp b/test/src/String/test_trim.cpp index c5168ecd..6fab9d06 100644 --- a/test/src/String/test_trim.cpp +++ b/test/src/String/test_trim.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isAscii.cpp b/test/src/WCharacter/test_isAscii.cpp index c6792719..37cb24ea 100644 --- a/test/src/WCharacter/test_isAscii.cpp +++ b/test/src/WCharacter/test_isAscii.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isControl.cpp b/test/src/WCharacter/test_isControl.cpp index adb41ccf..5f4763b8 100644 --- a/test/src/WCharacter/test_isControl.cpp +++ b/test/src/WCharacter/test_isControl.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isDigit.cpp b/test/src/WCharacter/test_isDigit.cpp index 146a863b..e5cdbd40 100644 --- a/test/src/WCharacter/test_isDigit.cpp +++ b/test/src/WCharacter/test_isDigit.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isHexadecimalDigit.cpp b/test/src/WCharacter/test_isHexadecimalDigit.cpp index 486a3e44..f714b9d9 100644 --- a/test/src/WCharacter/test_isHexadecimalDigit.cpp +++ b/test/src/WCharacter/test_isHexadecimalDigit.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isLowerCase.cpp b/test/src/WCharacter/test_isLowerCase.cpp index 9b05b458..6efd0210 100644 --- a/test/src/WCharacter/test_isLowerCase.cpp +++ b/test/src/WCharacter/test_isLowerCase.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isPunct.cpp b/test/src/WCharacter/test_isPunct.cpp index 7e6b49dc..40a9b59f 100644 --- a/test/src/WCharacter/test_isPunct.cpp +++ b/test/src/WCharacter/test_isPunct.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isSpace.cpp b/test/src/WCharacter/test_isSpace.cpp index 29ed8107..d041c3a2 100644 --- a/test/src/WCharacter/test_isSpace.cpp +++ b/test/src/WCharacter/test_isSpace.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isUpperCase.cpp b/test/src/WCharacter/test_isUpperCase.cpp index 598bb55b..f7be0ad8 100644 --- a/test/src/WCharacter/test_isUpperCase.cpp +++ b/test/src/WCharacter/test_isUpperCase.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_isWhitespace.cpp b/test/src/WCharacter/test_isWhitespace.cpp index 483c6477..c6ba850e 100644 --- a/test/src/WCharacter/test_isWhitespace.cpp +++ b/test/src/WCharacter/test_isWhitespace.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/WCharacter/test_toAscii.cpp b/test/src/WCharacter/test_toAscii.cpp index 96a2cfb9..8abb32d6 100644 --- a/test/src/WCharacter/test_toAscii.cpp +++ b/test/src/WCharacter/test_toAscii.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/dtostrf.cpp b/test/src/dtostrf.cpp index 0700debb..02ea2fe7 100644 --- a/test/src/dtostrf.cpp +++ b/test/src/dtostrf.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/itoa.cpp b/test/src/itoa.cpp index 292d0ef0..4070ca62 100644 --- a/test/src/itoa.cpp +++ b/test/src/itoa.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** diff --git a/test/src/main.cpp b/test/src/main.cpp index 84b7d4ed..5d425d0f 100644 --- a/test/src/main.cpp +++ b/test/src/main.cpp @@ -1,5 +1,7 @@ /* * Copyright (c) 2020 Arduino. All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later */ /************************************************************************************** From 3f3e8bd9011650e5ded95e1a4c8a2580accd49de Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 28 May 2024 12:02:32 +0200 Subject: [PATCH 60/61] license: add LICENSE file to the repository All files in this repository are licensed under the GNU Lesser General Public License version 2.1. Make this obvious by including the LICENSE file in the root of the repository. In addition to the above clause, some files may also be distributed under additional license terms. See each individual file for details. --- LICENSE | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..c6487f4f --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. + +We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. + +The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. + +GNU LESSER GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: + + a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. + + e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. + + b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). + +To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the library's name and an idea of what it does. + Copyright (C) year name of author + + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in +the library `Frob' (a library for tweaking knobs) written +by James Random Hacker. + +signature of Ty Coon, 1 April 1990 +Ty Coon, President of Vice +That's all there is to it! From ce1f76e040a9018bd3f492ca91bb778b346b0a05 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 28 May 2024 23:13:15 -0700 Subject: [PATCH 61/61] Fix spell check false positive by ignoring word The codespell spellchecker tool is used to automatically detect commonly misspelled words in the files of this project. The misspelled words dictionary was expanded in the latest release of codespell. Some of the text in the project codebase happens to match against newly added entries, which caused codespell to produce a false misspelled word detection. Since the code that produced the detection is correct and intended, the false positive is resolved by configuring codespell to ignore the problematic word. --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codespellrc b/.codespellrc index 8d12eef4..4da64a41 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,7 +1,7 @@ # See: https://github.com/codespell-project/codespell#using-a-config-file [codespell] # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: -ignore-words-list = hel +ignore-words-list = hel,shiftin check-filenames = check-hidden = skip = ./.git,./test/external