diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a09ac5..feca0c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,55 +4,79 @@ Changelog All notable changes to this project will be documented in this file. The format is based on -[Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to +[Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project +adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ******************************************************************************* +[1.4.1] - 2024-12-16 +---------------------------------------- + +Fixes for very strict compiler warning flags. + +### Fixed + +- `atto_zeros()` and `atto_nzeros()` fixes: + - cast the buffer to verify to `const unsigned char` instead of + `unsigned char` to avoid dropping any `const` qualifier of the buffer + - use `(unsigned) char` instead of `uint8_t` to avoid needing `stdint.h` + - avoid using variable names starting with double underscores as those are + reserved handles and the compiler might complain +- Add missing `#include "atto.h"` in `atto.`c. While typically works without + it, some compilers are complaining + +#### Fixed/improved project internals (not related to Atto itself) + +- Replace forced CMake compiler warning flags with `CMakePresets.json` + to make them recommended but optional +- Introduce `.gitattributes`, mostly to force native line endings in Git + working directory +- Introduce `.editorconfig`, mostly to force length limits for lines of + Markdown +- Introduce `.clang-format` +- Autoformat everything, including Readme, Changelog, CMakeLists, and C code ( + according to newly added `.clang-format`) + [1.4.0] - 2021-05-21 ---------------------------------------- -Counters of assertion passes and failures, simple status report printing, -check for non-all-zero arrays, fixes to avoid compilation warnings. +Counters of assertion passes and failures, simple status report printing, check +for non-all-zero arrays, fixes to avoid compilation warnings. ### Added - Counters `atto_counter_assert_passes` and `atto_counter_assert_failures` counting the amount of assertions `atto_assert()` or other aliases for it - that failed or passed, to be able to see the progress through the test - suite. -- `atto_report()` to provide a simple one-line indication of what is the - status of the 2 counters above at any point in the test suite, - including at the very end. -- `atto_nzeros()` which is the opposite of `atto_zeros()`, checking that - there is at least one non-zero value in the array of bytes. - Useful to check whether a memory location has been initialised to non-zero - values, especially for random strings or data from an outside - source we don't know the exact format of. + that failed or passed, to be able to see the progress through the test suite. +- `atto_report()` to provide a simple one-line indication of what is the status + of the 2 counters above at any point in the test suite, including at the very + end. +- `atto_nzeros()` which is the opposite of `atto_zeros()`, checking that there + is at least one non-zero value in the array of bytes. Useful to check whether + a memory location has been initialised to non-zero values, especially for + random strings or data from an outside source we don't know the exact format + of. - GitHub workflow scripts to build and self-test on different operating systems. Fancy badges in the readme included. - ### Fixed -- CMake configuration now uses a more portable set of compiler flags, - taken from LibAscon. +- CMake configuration now uses a more portable set of compiler flags, taken + from LibAscon. - Some macro arguments did not have round brackets around them. - Self-test changed to avoid compilation warnings due to improper use of types (integers for float/double functions and signed/unsigned warnings). -- Cast the length values passed to `atto_zeros()` to `size_t` to avoid - warnings about signed/unsigned integer comparison. +- Cast the length values passed to `atto_zeros()` to `size_t` to avoid warnings + about signed/unsigned integer comparison. - Remove `.idea` folder from Git repo from now on. - Fixed some typos/missing words in the BSD 3-Clause license text file. - Renamed Doxygen build target to avoid name clashes. -- Fix typo in Doxygen config, now it should properly exclude the test - and source file. +- Fix typo in Doxygen config, now it should properly exclude the test and + source file. - Fixed self-test skipping some of the checks. - - [1.3.1] - 2020-12-27 ---------------------------------------- @@ -64,8 +88,6 @@ No changes in the code, only documentation. Readme) - Missing title of the v1.3.0 release. - - [1.3.0] - 2020-12-27 ---------------------------------------- @@ -77,30 +99,26 @@ Clickable links to failed assertions! - `atto_true()` which simply maps to `atto_assert()` to have an opposite of `atto_false()` with consistent naming. - ### Changed -- The printed text in case of a failed testcase now combines the filename - and the line together in the format like `filename.c:42` with `42` being the +- The printed text in case of a failed testcase now combines the filename and + the line together in the format like `filename.c:42` with `42` being the line. This allows some IDEs to recognise it as a link to a specific code line and make them clickable for much easier testing and debugging. - ### Fixed - `atto_zeros(x, len)` supports any kind of address as `x`, even non `uint8_t*` - thus allowing to scan arrays of other integers or floats or strings for - zeros without explicitly casting them. They are converted to `uint8_t*` + thus allowing to scan arrays of other integers or floats or strings for zeros + without explicitly casting them. They are converted to `uint8_t*` internally. - Replace Doxyfile with CMake building it instead. Add stricter options. - - [1.2.0] - 2020-02-05 ---------------------------------------- -Two more macros, some project structure changes (new `atto.c` file, new `src/` +Two more macros, some project structure changes (new `atto.c` file, new `src/` folder). @@ -110,23 +128,19 @@ folder). memory segments are not equal. - `atto_zeros(x, len)` checks that a memory segment is filled with zeros. - ### Fixed - Move `atto_at_least_one_fail` variable into new separate `atto.c` file. Required as importing `atto.h` file in many locations leads to many _static_ - copies of the same variable to be set, which means that different files see - a different variable. + copies of the same variable to be set, which means that different files see a + different variable. - Move selftest into subfolder `tst/`, moved `atto.h` and `atto.c` into `src/` Required as when incorporating this whole project (or repo) - into another C project, the IDE may interpret selftest.c as part - of the main project, while it's not relevant. - With this trick, one can set the atto/src folder as the only relevant - one. + into another C project, the IDE may interpret selftest.c as part of the main + project, while it's not relevant. With this trick, one can set the atto/src + folder as the only relevant one. - Variety of minor fixes in the readme. - - [1.1.0] - 2019-10-06 ---------------------------------------- @@ -135,38 +149,35 @@ More specialized macros for operators and floats, simpler examples, self test. ### Added -- `atto_false(x)`, the negation of `atto_assert()`, to avoid forgetting the +- `atto_false(x)`, the negation of `atto_assert()`, to avoid forgetting the `!` when calling something like `atto_assert(!x)` - Equality, inequality and other comparision operators, in particular to avoid mistyping the operator, especially the `==` into an assignment `=` when calling something like `atto_assert(a == b)` - - Equality `atto_eq(a, b)` - - Inequality `atto_neq(a, b)` - - Less-Than `atto_lt(a, b)` - - Less-Equal `atto_le(a, b)` - - Greater-Than `atto_gt(a, b)` - - Greater-Equal `atto_ge(a, b)` + - Equality `atto_eq(a, b)` + - Inequality `atto_neq(a, b)` + - Less-Than `atto_lt(a, b)` + - Less-Equal `atto_le(a, b)` + - Greater-Than `atto_gt(a, b)` + - Greater-Equal `atto_ge(a, b)` - Floating point equality with a custom absolute tolerance - - For floats `atto_fdelta(a, b, abstol)` - - For doubles `atto_ddelta(a, b, abstol)` + - For floats `atto_fdelta(a, b, abstol)` + - For doubles `atto_ddelta(a, b, abstol)` - Non-finite floating point values checks - - Value is NaN `atto_nan(x)` - - Value is +/- Infinity `atto_inf(x)` - - Value is +Infinity `atto_plusinf(x)` - - Value is -Infinity `atto_minusinf(x)` - - Value is NaN or +/- Infinity `atto_notfinite(x)` - - Value is anything but Nan or +/- Infinity `atto_finite(x)` + - Value is NaN `atto_nan(x)` + - Value is +/- Infinity `atto_inf(x)` + - Value is +Infinity `atto_plusinf(x)` + - Value is -Infinity `atto_minusinf(x)` + - Value is NaN or +/- Infinity `atto_notfinite(x)` + - Value is anything but Nan or +/- Infinity `atto_finite(x)` - Proper self-test `selftest.c` of the whole Atto framework. - More compiler flags to check for errors during compilation of the self-test. - ### Removed - `example.c` test file. Instead a simpler example is provided within the Readme. - - [1.0.0] - 2019-05-08 ---------------------------------------- @@ -176,11 +187,11 @@ Initial version. ### Added - Various macros to test an assertion: - - `atto_assert()` - - `atto_fapprox()` - - `atto_dapprox()` - - `atto_flag()` - - `atto_noflag()` - - `atto_streq()` - - `atto_memeq()` - - `atto_fail()` + - `atto_assert()` + - `atto_fapprox()` + - `atto_dapprox()` + - `atto_flag()` + - `atto_noflag()` + - `atto_streq()` + - `atto_memeq()` + - `atto_fail()` diff --git a/CMakeLists.txt b/CMakeLists.txt index cf940ab..34639ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.9) # For FindDoxygen project(Atto - VERSION 1.4.0 + VERSION 1.4.1 LANGUAGES C DESCRIPTION "The microscopic C test framework") @@ -16,13 +16,13 @@ project(Atto # Build targets # ----------------------------------------------------------------------------- add_executable(atto_selftest - src/atto.h - src/atto.c - tst/selftest.c) + src/atto.h + src/atto.c + tst/selftest.c) target_include_directories(atto_selftest PRIVATE src/) if (NOT MSVC) -target_link_libraries(atto_selftest PRIVATE m) -endif() + target_link_libraries(atto_selftest PRIVATE m) +endif () enable_testing() add_test(NAME atto_selftest COMMAND atto_selftest) @@ -63,13 +63,13 @@ if (DOXYGEN_FOUND) # Graphviz's dot set(DOXYGEN_DOT_NUM_THREADS 0) # Auto set based on CPU - set(DOXYGEN_DOT_PATH ) # Empty path = search in $PATH + set(DOXYGEN_DOT_PATH) # Empty path = search in $PATH # Generate command doxygen_add_docs(atto_doxygen - src/atto.h LICENSE.md CHANGELOG.md README.md - # List of input files for Doxygen - ) + src/atto.h LICENSE.md CHANGELOG.md README.md + # List of input files for Doxygen + ) else (DOXYGEN_FOUND) message(WARNING "Doxygen not found. Cannot generate documentation.") endif (DOXYGEN_FOUND)