feat: Projektstruktur nach P1204R0
Layout, Build und Konventionen analog zu mydb und cxx_scaffold_cli: Header und Quellen nebeneinander in playground/, Unit-Tests als .test.c/.test.cpp daneben, Integrationstests in tests/. Geruest-Module counter (C, Unity) und notebook (C++, doctest) zeigen jede Regel einmal an lauffaehigem Code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
# House style. Byte-identical to the .clang-format already committed in PaulDB
|
||||||
|
# and tui-framework -- this file is the source of truth, not a new invention.
|
||||||
|
#
|
||||||
|
# Requires clang-format >= 19: BreakAfterReturnType was renamed from
|
||||||
|
# AlwaysBreakAfterReturnType in 19. Ubuntu 24.04 ships 18 and will REJECT this
|
||||||
|
# file -- install LLVM from apt.llvm.org there.
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReferenceAlignment: Left
|
||||||
|
ColumnLimit: 100
|
||||||
|
BreakAfterReturnType: All
|
||||||
|
BinPackParameters: false
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
ReflowComments: true
|
||||||
|
|
||||||
|
# Zusatz gegenueber der PaulDB-Fassung: ohne das rueckt clang-format den
|
||||||
|
# gesamten Inhalt eines extern "C"-Blocks um 4 ein. Da jeder C-Header hier fuer
|
||||||
|
# die C++-Seite einen solchen Block hat, waere das die Mehrheit jeder Datei.
|
||||||
|
IndentExternBlock: NoIndent
|
||||||
|
|
||||||
|
# LLVM setzt -2, was zu IndentWidth 2 passt. Bei IndentWidth 4 landen public:
|
||||||
|
# und private: sonst zwei Spalten eingerueckt statt buendig mit der Klammer.
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
|
||||||
|
# Damit clang-format bei page.test.c erkennt, dass <mydb/page.h> der
|
||||||
|
# Hauptheader ist und ihn nach ganz oben in einen eigenen Block sortiert.
|
||||||
|
# Der Vorgabewert kennt nur die Formen foo_test.c und foo-test.c, nicht die
|
||||||
|
# P1204-Form foo.test.c.
|
||||||
|
IncludeIsMainRegex: '(\.test)?$'
|
||||||
|
|
||||||
|
# Include ordering, so that Regroup has a policy to apply.
|
||||||
|
# P1204R0: own headers are included as <mydb/foo.h>, never "foo.h".
|
||||||
|
IncludeCategories:
|
||||||
|
# Own project headers first.
|
||||||
|
- Regex: '^<mydb/'
|
||||||
|
Priority: 1
|
||||||
|
# Vendored test frameworks.
|
||||||
|
- Regex: '^<(unity|doctest)'
|
||||||
|
Priority: 2
|
||||||
|
# C standard library.
|
||||||
|
- Regex: '^<(assert|ctype|errno|inttypes|limits|stdalign|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|time)\.h>$'
|
||||||
|
Priority: 3
|
||||||
|
# C++ standard library (extensionless).
|
||||||
|
- Regex: '^<[a-z_]+>$'
|
||||||
|
Priority: 4
|
||||||
|
# Everything else (system, third-party).
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 5
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
# House checks. Adopted from PaulDB/tui-framework unchanged EXCEPT
|
||||||
|
# HeaderFilterRegex.
|
||||||
|
#
|
||||||
|
# The original was '.*', which makes clang-tidy analyse every transitively
|
||||||
|
# included header -- including the standard library and the vendored 363 KB
|
||||||
|
# doctest.h. Running live through clangd, that floods the editor with
|
||||||
|
# diagnostics you cannot act on. Scoped to this project's own source tree
|
||||||
|
# instead; third_party/ is a sibling directory and so is excluded by construction.
|
||||||
|
Checks: >
|
||||||
|
bugprone-*,
|
||||||
|
cert-*,
|
||||||
|
clang-analyzer-*,
|
||||||
|
misc-*,
|
||||||
|
performance-*,
|
||||||
|
portability-*,
|
||||||
|
readability-*,
|
||||||
|
-readability-magic-numbers,
|
||||||
|
-readability-identifier-length,
|
||||||
|
-readability-function-cognitive-complexity,
|
||||||
|
-readability-braces-around-statements,
|
||||||
|
-cert-err33-c,
|
||||||
|
-misc-include-cleaner,
|
||||||
|
-readability-implicit-bool-conversion
|
||||||
|
|
||||||
|
CheckOptions:
|
||||||
|
- key: bugprone-easily-swappable-parameters.MinimumLength
|
||||||
|
value: 3
|
||||||
|
- key: readability-identifier-naming.FunctionCase
|
||||||
|
value: lower_case
|
||||||
|
- key: readability-identifier-naming.VariableCase
|
||||||
|
value: lower_case
|
||||||
|
- key: readability-identifier-naming.MacroDefinitionCase
|
||||||
|
value: UPPER_CASE
|
||||||
|
- key: readability-identifier-naming.TypedefCase
|
||||||
|
value: CamelCase
|
||||||
|
- key: readability-identifier-naming.StructCase
|
||||||
|
value: CamelCase
|
||||||
|
|
||||||
|
HeaderFilterRegex: '.*/playground/.*'
|
||||||
|
FormatStyle: file
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# clangd project configuration.
|
||||||
|
#
|
||||||
|
# CompilationDatabase points at the build tree directly. Note what this replaces:
|
||||||
|
# copying or symlinking compile_commands.json into the project root, which goes
|
||||||
|
# stale silently and is how the previous setup broke.
|
||||||
|
CompileFlags:
|
||||||
|
CompilationDatabase: build/debug
|
||||||
|
|
||||||
|
Index:
|
||||||
|
Background: Build
|
||||||
|
StandardLibrary: Yes
|
||||||
|
|
||||||
|
Diagnostics:
|
||||||
|
# misc-include-cleaner is already disabled in .clang-tidy; these are clangd's
|
||||||
|
# own equivalents and would contradict it.
|
||||||
|
UnusedIncludes: None
|
||||||
|
MissingIncludes: None
|
||||||
|
|
||||||
|
InlayHints:
|
||||||
|
Enabled: Yes
|
||||||
|
ParameterNames: Yes
|
||||||
|
DeducedTypes: Yes
|
||||||
|
|
||||||
|
---
|
||||||
|
# Vendored code is not ours: no diagnostics, no clang-tidy, ever. Without this,
|
||||||
|
# opening third_party/doctest/doctest.h shows hundreds of findings from our own
|
||||||
|
# strict check list against code we will never edit.
|
||||||
|
If:
|
||||||
|
PathMatch: .*/third_party/.*
|
||||||
|
Diagnostics:
|
||||||
|
Suppress: '*'
|
||||||
|
ClangTidy:
|
||||||
|
Remove:
|
||||||
|
- '*'
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Bridges the tabs-vs-spaces gap that no existing project had a policy for.
|
||||||
|
# Agrees with .clang-format (IndentWidth 4, UseTab Never, ColumnLimit 100).
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{c,h,cpp,hpp}]
|
||||||
|
max_line_length = 100
|
||||||
|
|
||||||
|
[*.{json,yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
+180
@@ -0,0 +1,180 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# playground
|
||||||
|
#
|
||||||
|
# Struktur nach P1204R0 "Canonical Project Structure":
|
||||||
|
# playground/playground/ Quellcode UND Header nebeneinander (kein include/ + src/)
|
||||||
|
# playground/tests/ nur Integrationstests gegen die oeffentliche API
|
||||||
|
# *.test.c/.cpp Unit-Tests direkt neben dem getesteten Modul
|
||||||
|
#
|
||||||
|
# Include-Konvention: eigene Header immer <playground/foo.h>, nie "foo.h".
|
||||||
|
# Spitze Klammern durchsuchen nur die -I-Pfade, niemals das Verzeichnis der
|
||||||
|
# inkludierenden Datei -- ein fehlender Header fliegt damit sofort auf, statt
|
||||||
|
# dass zufaellig ein gleichnamiger lokaler Header gefunden wird.
|
||||||
|
#
|
||||||
|
# Extensions: .h/.c fuer C, .hpp/.cpp fuer C++. Die Extension sagt also die
|
||||||
|
# Sprache -- in einem gemischten Projekt ist das der Punkt.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# 3.28 = die CMake-Version aus Ubuntu 24.04 LTS. NICHT auf die lokale 4.4
|
||||||
|
# hochziehen: genau das macht hello-cpp (4.4), und das laesst sich auf keinem
|
||||||
|
# LTS-Server mehr konfigurieren.
|
||||||
|
cmake_minimum_required(VERSION 3.28)
|
||||||
|
|
||||||
|
project(playground
|
||||||
|
VERSION 0.1.0
|
||||||
|
DESCRIPTION "Experimentierprojekt nach P1204R0"
|
||||||
|
LANGUAGES C CXX)
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Sprachstandards: C23 + C++23, keine GNU-Extensions
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
set(CMAKE_C_STANDARD 23)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_C_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# compile_commands.json: HIER, nicht auf der Kommandozeile.
|
||||||
|
# Muss vor dem ersten Target stehen, sonst bekommt clangd eine veraltete Datei.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# C++20-Modul-Scanning aus. Sonst schreibt Ninja bei CXX_STANDARD 23 ein
|
||||||
|
# "@CMakeFiles/<target>.dir/<datei>.o.modmap" in jeden Compile-Command, und
|
||||||
|
# clangd stolpert ueber die Response-Datei, sobald build/ geleert wurde.
|
||||||
|
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
|
||||||
|
|
||||||
|
# Ohne explizites CMAKE_BUILD_TYPE waeren alle -O/-g-Flags leer.
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Binaries an einen vorhersagbaren Ort, damit die File-API-Artefakte und der
|
||||||
|
# Neovim-Target-Picker stabile Pfade sehen.
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# ccache, wenn vorhanden. Ueber COMPILER_LAUNCHER, NICHT ueber die
|
||||||
|
# Compiler-Shims in ccaches libexec -- die faengt jeden Compiler-Aufruf des
|
||||||
|
# gesamten Systems ab.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
if(NOT CMAKE_C_COMPILER_LAUNCHER AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
|
||||||
|
find_program(CCACHE_PROGRAM ccache)
|
||||||
|
if(CCACHE_PROGRAM)
|
||||||
|
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
|
message(STATUS "ccache: ${CCACHE_PROGRAM}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(Warnings)
|
||||||
|
include(Sanitizers)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Kernbibliothek - neue Dateien hier manuell eintragen (kein GLOB).
|
||||||
|
#
|
||||||
|
# GLOB waere bequem, aber CMake merkt nicht, wenn eine Datei dazukommt: der
|
||||||
|
# Build bleibt gruen und die neue Datei ist einfach nicht dabei.
|
||||||
|
#
|
||||||
|
# *.test.c und *.test.cpp gehoeren NICHT hierher (P1204R0 Regel 7.1) -- die
|
||||||
|
# werden unten zu eigenen Executables.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
set(PLAYGROUND_SOURCES
|
||||||
|
playground/counter.c
|
||||||
|
playground/notebook.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(PLAYGROUND_HEADERS
|
||||||
|
playground/counter.h
|
||||||
|
playground/notebook.hpp
|
||||||
|
playground/details/bits.h
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(playground_core STATIC ${PLAYGROUND_SOURCES} ${PLAYGROUND_HEADERS})
|
||||||
|
|
||||||
|
# Der Include-Root ist das PROJEKTWURZELVERZEICHNIS, nicht playground/playground.
|
||||||
|
# Nur so loest <playground/counter.h> auf playground/playground/counter.h auf.
|
||||||
|
target_include_directories(playground_core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
|
target_link_libraries(playground_core PRIVATE playground_warnings)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Programm
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
add_executable(playground playground/main.cpp)
|
||||||
|
target_link_libraries(playground PRIVATE playground_core playground_warnings)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Tests
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
# Fehlt third_party/, bleibt das Projekt konfigurierbar (clangd funktioniert)
|
||||||
|
# und nur die Unit-Test-Targets entfallen.
|
||||||
|
set(PLAYGROUND_HAVE_UNITY FALSE)
|
||||||
|
set(PLAYGROUND_HAVE_DOCTEST FALSE)
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/unity/unity.c")
|
||||||
|
set(PLAYGROUND_HAVE_UNITY TRUE)
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/doctest/doctest.h")
|
||||||
|
set(PLAYGROUND_HAVE_DOCTEST TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PLAYGROUND_HAVE_UNITY OR PLAYGROUND_HAVE_DOCTEST)
|
||||||
|
add_subdirectory(third_party)
|
||||||
|
else()
|
||||||
|
message(WARNING "third_party/ ist leer -- keine Unit-Test-Targets.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Unit-Test in C: <modul>.test.c -> Executable <modul>.test -> CTest
|
||||||
|
# "unity.<modul>". Der neotest-Adapter in Neovim verlaesst sich auf genau
|
||||||
|
# diesen Namen.
|
||||||
|
function(playground_add_unity_test module)
|
||||||
|
if(NOT PLAYGROUND_HAVE_UNITY)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(target "${module}.test")
|
||||||
|
add_executable(${target} "playground/${module}.test.c")
|
||||||
|
target_link_libraries(${target} PRIVATE playground_core unity playground_warnings)
|
||||||
|
add_test(NAME "unity.${module}" COMMAND ${target})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Unit-Test in C++: <modul>.test.cpp. doctest_discover_tests() ruft die
|
||||||
|
# Executable beim Build mit --list-test-cases auf und legt EINEN CTest-Eintrag
|
||||||
|
# pro TEST_CASE an. Das ist Pflicht, nicht Kosmetik: neotest-ctest kann
|
||||||
|
# Testnamen nur so auf Quellpositionen abbilden.
|
||||||
|
function(playground_add_doctest_test module)
|
||||||
|
if(NOT PLAYGROUND_HAVE_DOCTEST)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(target "${module}.test")
|
||||||
|
add_executable(${target} "playground/${module}.test.cpp")
|
||||||
|
target_link_libraries(${target} PRIVATE playground_core doctest playground_warnings)
|
||||||
|
doctest_discover_tests(${target} TEST_PREFIX "doctest.")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
playground_add_unity_test(counter)
|
||||||
|
playground_add_doctest_test(notebook)
|
||||||
|
|
||||||
|
# Integrationstests (P1204R0 Regel 7.2): eigenes tests/-Verzeichnis, laufen
|
||||||
|
# gegen die oeffentliche API -- also genau gegen das, was ein Benutzer bekommt.
|
||||||
|
add_subdirectory(tests)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Install
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
install(TARGETS playground RUNTIME DESTINATION bin)
|
||||||
|
install(DIRECTORY playground/
|
||||||
|
DESTINATION "include/playground"
|
||||||
|
FILES_MATCHING
|
||||||
|
PATTERN "*.h"
|
||||||
|
PATTERN "*.hpp"
|
||||||
|
PATTERN "private" EXCLUDE)
|
||||||
|
|
||||||
|
message(STATUS "playground ${PROJECT_VERSION} | C${CMAKE_C_STANDARD} C++${CMAKE_CXX_STANDARD} | "
|
||||||
|
"${CMAKE_BUILD_TYPE} | ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
{
|
||||||
|
"version": 6,
|
||||||
|
"cmakeMinimumRequired": { "major": 3, "minor": 28, "patch": 0 },
|
||||||
|
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "base",
|
||||||
|
"hidden": true,
|
||||||
|
"generator": "Ninja",
|
||||||
|
"description": "binaryDir MUST stay at depth 2 (build/<preset>): neotest-ctest scans only three levels deep for a CTest database, and util/cmake.lua derives the File API path from this layout.",
|
||||||
|
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||||
|
"CMAKE_C_COMPILER": "clang",
|
||||||
|
"CMAKE_CXX_COMPILER": "clang++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"inherits": "base",
|
||||||
|
"displayName": "Debug (clang, Ninja)",
|
||||||
|
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "release",
|
||||||
|
"inherits": "base",
|
||||||
|
"displayName": "Release (clang, Ninja)",
|
||||||
|
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "asan-ubsan",
|
||||||
|
"inherits": "base",
|
||||||
|
"displayName": "Debug + AddressSanitizer + UBSan",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"PLAYGROUND_SANITIZE": "address,undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "apple-clang",
|
||||||
|
"inherits": "base",
|
||||||
|
"displayName": "Portability: Apple clang",
|
||||||
|
"description": "Catches assumptions that only hold for Homebrew's libc++.",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" },
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_C_COMPILER": "/usr/bin/clang",
|
||||||
|
"CMAKE_CXX_COMPILER": "/usr/bin/clang++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "homebrew-gcc",
|
||||||
|
"inherits": "base",
|
||||||
|
"displayName": "Portability: GCC (macOS, Homebrew)",
|
||||||
|
"description": "Catches GCC frontend divergence -- different -Wconversion behaviour, stricter diagnostics, C23 differences -- before the Ubuntu box does. Does NOT catch glibc/ELF/ABI issues, since this still uses the Apple SDK and ld64.",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" },
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_C_COMPILER": "gcc-16",
|
||||||
|
"CMAKE_CXX_COMPILER": "g++-16"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "linux-gcc",
|
||||||
|
"inherits": "base",
|
||||||
|
"displayName": "Portability: GCC (Linux)",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" },
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
|
"CMAKE_CXX_COMPILER": "g++"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"buildPresets": [
|
||||||
|
{ "name": "debug", "configurePreset": "debug" },
|
||||||
|
{ "name": "release", "configurePreset": "release" },
|
||||||
|
{ "name": "asan-ubsan", "configurePreset": "asan-ubsan" },
|
||||||
|
{
|
||||||
|
"name": "apple-clang",
|
||||||
|
"configurePreset": "apple-clang",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "homebrew-gcc",
|
||||||
|
"configurePreset": "homebrew-gcc",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "linux-gcc",
|
||||||
|
"configurePreset": "linux-gcc",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"testPresets": [
|
||||||
|
{
|
||||||
|
"name": "base",
|
||||||
|
"hidden": true,
|
||||||
|
"output": { "outputOnFailure": true, "shortProgress": true },
|
||||||
|
"execution": { "noTestsAction": "error", "stopOnFailure": false }
|
||||||
|
},
|
||||||
|
{ "name": "debug", "inherits": "base", "configurePreset": "debug" },
|
||||||
|
{ "name": "release", "inherits": "base", "configurePreset": "release" },
|
||||||
|
{ "name": "asan-ubsan", "inherits": "base", "configurePreset": "asan-ubsan" },
|
||||||
|
{
|
||||||
|
"name": "apple-clang",
|
||||||
|
"inherits": "base",
|
||||||
|
"configurePreset": "apple-clang",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "homebrew-gcc",
|
||||||
|
"inherits": "base",
|
||||||
|
"configurePreset": "homebrew-gcc",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "linux-gcc",
|
||||||
|
"inherits": "base",
|
||||||
|
"configurePreset": "linux-gcc",
|
||||||
|
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,2 +1,51 @@
|
|||||||
# playground
|
# playground
|
||||||
|
|
||||||
|
Experimentierprojekt. Struktur nach
|
||||||
|
[P1204R0 "Canonical Project Structure"](https://wg21.link/p1204r0), Konventionen
|
||||||
|
und Build-Setup identisch zu `mydb` und `cxx_scaffold_cli`.
|
||||||
|
|
||||||
|
Der Punkt dieses Repos ist die Form, nicht der Inhalt: `counter` (C) und
|
||||||
|
`notebook` (C++) sind Gerüst-Module, die jede Regel einmal an lauffähigem Code
|
||||||
|
zeigen. Zum Experimentieren werden sie ersetzt.
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
playground/
|
||||||
|
├── playground/ Quellcode UND Header nebeneinander
|
||||||
|
│ ├── counter.h/.c C-Modul, opakes Struct, extern "C"
|
||||||
|
│ ├── counter.test.c Unit-Test daneben (Unity)
|
||||||
|
│ ├── notebook.hpp/.cpp C++-Modul, namespace playground
|
||||||
|
│ ├── notebook.test.cpp Unit-Test daneben (doctest)
|
||||||
|
│ ├── main.cpp
|
||||||
|
│ └── details/ Implementation Details, nicht public API
|
||||||
|
├── tests/basics/ Integrationstest, nur öffentliche API
|
||||||
|
├── third_party/ vendortes Unity + doctest, nie editieren
|
||||||
|
├── cmake/ Warnings.cmake, Sanitizers.cmake
|
||||||
|
└── docs/ CONVENTIONS.md, ADRs
|
||||||
|
```
|
||||||
|
|
||||||
|
Kein `include/` + `src/`. Eigene Header immer `<playground/counter.h>`, nie
|
||||||
|
`"counter.h"` — das ist P1204R0s wichtigste Einzelregel.
|
||||||
|
|
||||||
|
## Bauen
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake --preset debug
|
||||||
|
cmake --build --preset debug
|
||||||
|
ctest --preset debug
|
||||||
|
./build/debug/bin/playground
|
||||||
|
```
|
||||||
|
|
||||||
|
Presets: `debug`, `release`, `asan-ubsan`, `apple-clang`, `homebrew-gcc`,
|
||||||
|
`linux-gcc`. Details in [docs/CONVENTIONS.md](docs/CONVENTIONS.md).
|
||||||
|
|
||||||
|
## Ein neues Modul hinzufügen
|
||||||
|
|
||||||
|
1. `playground/<name>.hpp` + `.cpp` anlegen (bzw. `.h`/`.c` für C).
|
||||||
|
2. Beide in `CMakeLists.txt` bei `PLAYGROUND_SOURCES` / `PLAYGROUND_HEADERS`
|
||||||
|
eintragen — **kein `file(GLOB)`**, sonst bleibt der Build grün und die Datei
|
||||||
|
fehlt einfach.
|
||||||
|
3. `playground/<name>.test.cpp` daneben, dann
|
||||||
|
`playground_add_doctest_test(<name>)` aufrufen (C: `.test.c` und
|
||||||
|
`playground_add_unity_test(<name>)`).
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Sanitizers, ueber -DPLAYGROUND_SANITIZE=address,undefined aktiviert
|
||||||
|
# (das asan-ubsan-Preset setzt genau das).
|
||||||
|
#
|
||||||
|
# Warum das gerade hier zaehlt: in einem Playground steht oft genau der Code,
|
||||||
|
# den man noch nicht versteht -- rohe Puffer, Pointer-Arithmetik, fremde APIs.
|
||||||
|
# Ein Off-by-one beschaedigt stillschweigend Nachbardaten; ein selbstgebauter
|
||||||
|
# assert-Test sieht das nie, ASan sofort.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set(PLAYGROUND_SANITIZE "" CACHE STRING
|
||||||
|
"Komma-getrennte Sanitizer-Liste, z.B. address,undefined")
|
||||||
|
|
||||||
|
if(NOT PLAYGROUND_SANITIZE STREQUAL "")
|
||||||
|
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang"))
|
||||||
|
message(WARNING "PLAYGROUND_SANITIZE wird von ${CMAKE_CXX_COMPILER_ID} nicht unterstuetzt")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_flags
|
||||||
|
-fsanitize=${PLAYGROUND_SANITIZE}
|
||||||
|
|
||||||
|
# Ohne Frame-Pointer sind die ASan-Stacks unbrauchbar.
|
||||||
|
-fno-omit-frame-pointer
|
||||||
|
|
||||||
|
# Inlining verschluckt sonst die Zeilennummer, in der der Fehler steckt.
|
||||||
|
-fno-optimize-sibling-calls
|
||||||
|
)
|
||||||
|
|
||||||
|
if(PLAYGROUND_SANITIZE MATCHES "undefined")
|
||||||
|
# Entscheidend: ohne das MELDET UBSan den Fehler nur und laeuft weiter,
|
||||||
|
# der Test wird gruen und die Meldung verschwindet im Scrollback.
|
||||||
|
# So schlaegt der Test tatsaechlich fehl.
|
||||||
|
list(APPEND _flags -fno-sanitize-recover=undefined)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_compile_options(${_flags})
|
||||||
|
add_link_options(-fsanitize=${PLAYGROUND_SANITIZE})
|
||||||
|
|
||||||
|
message(STATUS "Sanitizers: ${PLAYGROUND_SANITIZE}")
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Warnungen als INTERFACE-Target.
|
||||||
|
#
|
||||||
|
# Als Target und nicht als globales CMAKE_C_FLAGS, damit der vendorte Code in
|
||||||
|
# third_party/ die Warnungen NICHT abbekommt: unity.c und doctest.h sind nicht
|
||||||
|
# unser Code, und -Wconversion darauf ergibt nur Rauschen.
|
||||||
|
#
|
||||||
|
# Kein -Werror (bewusste Entscheidung): waehrend eines TDD-Zyklus soll ein
|
||||||
|
# unbenutztes Argument den Build nicht blockieren. Warnungen werden trotzdem
|
||||||
|
# live in Neovim angezeigt, weil clangd sie ohnehin liefert.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
add_library(playground_warnings INTERFACE)
|
||||||
|
|
||||||
|
set(PLAYGROUND_GCC_LIKE_WARNINGS
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
|
||||||
|
# Shadowing ist in C mit kurzen Namen (p, h, s) eine echte Fehlerquelle.
|
||||||
|
-Wshadow
|
||||||
|
|
||||||
|
# Implizite Verengungen (size_t -> uint16_t und aehnliches). Explizite
|
||||||
|
# Casts -- (uint16_t) len -- schweigen weiterhin, implizite nicht.
|
||||||
|
-Wconversion
|
||||||
|
-Wsign-conversion
|
||||||
|
|
||||||
|
-Wcast-qual
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wformat=2
|
||||||
|
-Wundef
|
||||||
|
-Wunused
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wimplicit-fallthrough
|
||||||
|
|
||||||
|
-Warray-bounds
|
||||||
|
)
|
||||||
|
|
||||||
|
# Bewusst NICHT dabei: -Wcast-align.
|
||||||
|
#
|
||||||
|
# Uebernommen aus dem Hausstandard: clang warnt bereits, wenn ein uint8_t* auf
|
||||||
|
# einen ausgerichteten Typ gecastet wird, unabhaengig davon, wie der Puffer
|
||||||
|
# tatsaechlich ausgerichtet ist -- also auch auf korrektem Code. Wer hier mit
|
||||||
|
# rohen Puffern experimentiert, sichert die Ausrichtung im Code zu
|
||||||
|
# (alignas(...)), wo sie ueberpruefbar ist.
|
||||||
|
|
||||||
|
set(PLAYGROUND_C_ONLY_WARNINGS
|
||||||
|
# Ein () statt (void) in C ist eine Funktion mit unbekannten Parametern --
|
||||||
|
# in C23 zwar geheilt, aber die Warnung haelt aelteren Code ehrlich.
|
||||||
|
-Wstrict-prototypes
|
||||||
|
-Wmissing-prototypes
|
||||||
|
-Wold-style-definition
|
||||||
|
)
|
||||||
|
|
||||||
|
set(PLAYGROUND_CXX_ONLY_WARNINGS
|
||||||
|
-Wnon-virtual-dtor
|
||||||
|
-Woverloaded-virtual
|
||||||
|
-Wold-style-cast
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_options(playground_warnings INTERFACE
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,GNU,Clang,AppleClang>:${PLAYGROUND_GCC_LIKE_WARNINGS};${PLAYGROUND_C_ONLY_WARNINGS}>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>:${PLAYGROUND_GCC_LIKE_WARNINGS};${PLAYGROUND_CXX_ONLY_WARNINGS}>
|
||||||
|
)
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
# Konventionen
|
||||||
|
|
||||||
|
Was `clang-format` und `clang-tidy` nicht erzwingen können, steht hier.
|
||||||
|
Mechanisch erzwungen wird bisher nur, was `clang-format` und `clang-tidy`
|
||||||
|
abdecken. Ein `check_style.sh` gibt es in diesem Repo **nicht** (die
|
||||||
|
CONVENTIONS.md von mydb verweist darauf, aber die Datei existiert dort
|
||||||
|
ebenfalls nicht) — die folgenden Regeln gelten also per Konvention.
|
||||||
|
|
||||||
|
## Projektstruktur (P1204R0)
|
||||||
|
|
||||||
|
```
|
||||||
|
playground/
|
||||||
|
├── playground/ <- Quellcode UND Header zusammen
|
||||||
|
│ ├── counter.h public API (C)
|
||||||
|
│ ├── counter.c
|
||||||
|
│ ├── counter.test.c Unit-Test, direkt neben dem Modul
|
||||||
|
│ ├── notebook.hpp public API (C++)
|
||||||
|
│ ├── notebook.cpp
|
||||||
|
│ ├── notebook.test.cpp
|
||||||
|
│ ├── main.cpp
|
||||||
|
│ └── details/ Implementation Details, nicht public API
|
||||||
|
├── tests/basics/ Integrationstests gegen die öffentliche API
|
||||||
|
├── third_party/ vendorter Fremdcode, nie editieren
|
||||||
|
├── cmake/ Warnings.cmake, Sanitizers.cmake
|
||||||
|
└── docs/ diese Datei, ADRs
|
||||||
|
```
|
||||||
|
|
||||||
|
`counter` und `notebook` sind Gerüst: sie zeigen jede Regel einmal an einem
|
||||||
|
lauffähigen Beispiel und sind dazu da, ersetzt zu werden. Was bleiben soll,
|
||||||
|
ist die Form, nicht der Inhalt.
|
||||||
|
|
||||||
|
**Kein `include/` + `src/`.** Header und Implementierung liegen nebeneinander.
|
||||||
|
Bei Templates, `inline` und Modulen ist die Trennung ohnehin nicht sauber
|
||||||
|
zu ziehen, und der Verzeichnisname `playground/` übernimmt die Rolle des Namespace
|
||||||
|
im Dateisystem.
|
||||||
|
|
||||||
|
## Includes
|
||||||
|
|
||||||
|
**Eigene Header immer mit spitzen Klammern und Projektpräfix:**
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <playground/counter.h> /* richtig */
|
||||||
|
#include "counter.h" /* falsch */
|
||||||
|
```
|
||||||
|
|
||||||
|
Das ist P1204R0s wichtigste Einzelregel. Spitze Klammern durchsuchen nur die
|
||||||
|
`-I`-Pfade, niemals das Verzeichnis der inkludierenden Datei — ein fehlender
|
||||||
|
oder falsch installierter Header fällt damit sofort auf, statt dass zufällig
|
||||||
|
ein gleichnamiger Nachbar gefunden wird.
|
||||||
|
|
||||||
|
Reihenfolge macht `clang-format` (`IncludeBlocks: Regroup`): eigener Header,
|
||||||
|
Projekt-Header, Test-Framework, C-Standardbibliothek, C++-Standardbibliothek,
|
||||||
|
Rest.
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
| Extension | Bedeutung |
|
||||||
|
|---|---|
|
||||||
|
| `.h` / `.c` | C |
|
||||||
|
| `.hpp` / `.cpp` | C++ |
|
||||||
|
| `.test.c` / `.test.cpp` | Unit-Test neben dem getesteten Modul |
|
||||||
|
|
||||||
|
Die Extension sagt die Sprache. In einem gemischten Projekt ist das der Punkt —
|
||||||
|
ein `.h` ist aus C **und** C++ benutzbar (der `extern "C"`-Block im Header),
|
||||||
|
ein `.hpp` nur aus C++.
|
||||||
|
|
||||||
|
## Namen
|
||||||
|
|
||||||
|
| Was | Form | Beispiel |
|
||||||
|
|---|---|---|
|
||||||
|
| Typen | `PascalCase` | `Counter`, `Notebook` |
|
||||||
|
| Funktionen, Variablen | `snake_case` | `counter_tick`, `free_space_offset` |
|
||||||
|
| Makros | `UPPER_CASE` mit Projektpräfix | `PLAYGROUND_COUNTER_LIMIT` |
|
||||||
|
| C-API | Modulpräfix | `counter_create`, `counter_free`, `counter_tick` |
|
||||||
|
| Out-Parameter | `out_`-Präfix | `size_t* out_len` |
|
||||||
|
| Member | blank, kein `m_`, kein `_` | `items`, `width` |
|
||||||
|
| Namespace | Projektname ohne `lib` | `namespace playground` |
|
||||||
|
|
||||||
|
## Kommentare
|
||||||
|
|
||||||
|
Ausschließlich `/* */`, niemals `//` — auch nicht einzeilig. Abschnitte werden
|
||||||
|
so getrennt:
|
||||||
|
|
||||||
|
```c
|
||||||
|
/* ---- API ---- */
|
||||||
|
```
|
||||||
|
|
||||||
|
Kommentare sind auf Deutsch, **Umlaute transliteriert** (`ae oe ue ss`), damit
|
||||||
|
die Quellen reines ASCII bleiben. README und öffentliche Header auf Englisch.
|
||||||
|
Prüfen lässt sich das mit:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
grep -rlP '[^\x00-\x7F]' playground tests
|
||||||
|
```
|
||||||
|
|
||||||
|
## Header
|
||||||
|
|
||||||
|
`#ifndef PLAYGROUND_COUNTER_H` — Include-Guards, kein `#pragma once`.
|
||||||
|
Öffentliche C-Header bekommen einen `extern "C"`-Block, damit die C++-Seite sie
|
||||||
|
benutzen kann.
|
||||||
|
|
||||||
|
Structs, deren Layout niemanden angeht, sind opak: `typedef struct Counter Counter;`
|
||||||
|
im Header, die Definition in der `.c`.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
**Unit-Test** (`<modul>.test.c` / `.test.cpp`) liegt neben dem Modul, kennt
|
||||||
|
dessen Interna und ist eine eigenständige Executable.
|
||||||
|
|
||||||
|
- C → Unity, registriert als CTest `unity.<modul>` (hier: `unity.counter`)
|
||||||
|
- C++ → doctest, `doctest_discover_tests()` legt **einen CTest-Eintrag pro
|
||||||
|
`TEST_CASE`** an
|
||||||
|
|
||||||
|
**Integrationstest** (`tests/<name>/driver.c` oder `.cpp`) benutzt nur die öffentliche API,
|
||||||
|
kein Framework, Ergebnis über den Exit-Code. Er würde genauso gegen eine
|
||||||
|
installierte Bibliothek laufen.
|
||||||
|
|
||||||
|
TDD-Zyklus: RED (Test schlägt aus dem richtigen Grund fehl) → GREEN (kleinste
|
||||||
|
Implementierung) → REFACTOR.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Kein `file(GLOB)`. Neue Dateien werden in `CMakeLists.txt` eingetragen — CMake
|
||||||
|
merkt sonst nicht, dass eine Datei dazugekommen ist, der Build bleibt grün und
|
||||||
|
die Datei fehlt einfach.
|
||||||
|
|
||||||
|
| Preset | Zweck |
|
||||||
|
|---|---|
|
||||||
|
| `debug` | Alltag |
|
||||||
|
| `release` | RelWithDebInfo |
|
||||||
|
| `asan-ubsan` | AddressSanitizer + UBSan |
|
||||||
|
| `apple-clang` | Portabilitätsprobe (macOS-System-Compiler) |
|
||||||
|
| `homebrew-gcc` | Portabilitätsprobe (GCC-Frontend) |
|
||||||
|
| `linux-gcc` | nur auf Linux sichtbar |
|
||||||
|
|
||||||
|
`build/<preset>/` — die Tiefe ist bindend: der neotest-CTest-Adapter sucht nur
|
||||||
|
drei Ebenen tief, und der Neovim-Target-Picker leitet den File-API-Pfad daraus ab.
|
||||||
|
|
||||||
|
## Commits
|
||||||
|
|
||||||
|
Conventional Commits: `feat:`, `fix:`, `test:`, `refactor:`, `chore:`, `docs:`.
|
||||||
|
Aktuell ohne Hook — es gibt kein `check_style.sh`, das einen installieren
|
||||||
|
könnte.
|
||||||
|
|
||||||
|
## Zwei Dinge, die wie Fehler aussehen, aber keine sind
|
||||||
|
|
||||||
|
**Nach einem frischen Clone zeigt clangd nichts.** Es gibt noch kein
|
||||||
|
`compile_commands.json`. Einmal `<leader>oc` (configure), dann ist alles da.
|
||||||
|
Neovim weist beim Öffnen einer C/C++-Datei darauf hin.
|
||||||
|
|
||||||
|
**Der Testbaum (`<leader>ts`) ist nach einem frischen Clone leer.**
|
||||||
|
`doctest_discover_tests()` ruft die Test-Executable beim **Build** auf, um die
|
||||||
|
`TEST_CASE`s aufzulisten. Vor dem ersten Build kennt CTest sie also nicht. Einmal
|
||||||
|
`<leader>b`, dann füllt sich der Baum.
|
||||||
|
|
||||||
|
## Rückfallebene für die C-Tests
|
||||||
|
|
||||||
|
Der neotest-Adapter für Unity (`nvim-local/neotest-unity`) ist selbst
|
||||||
|
geschrieben, weil `neotest-ctest` `.c`-Dateien grundsätzlich nicht sieht. Wenn er
|
||||||
|
je zur Last wird: aus der `adapters`-Liste in `nvim/lua/plugins/neotest.lua`
|
||||||
|
entfernen, neotest bleibt für C++ zuständig, und die C-Tests laufen über
|
||||||
|
`<leader>ot` (overseer → ctest → Quickfix). Dann fehlt der Rot/Grün-Baum für C,
|
||||||
|
aber ein Tastendruck und Sprung zur Fehlerstelle bleiben.
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# ADR 0001 — Toolchain und Projektstruktur
|
||||||
|
|
||||||
|
- Status: akzeptiert
|
||||||
|
- Datum: 2026-08-30
|
||||||
|
|
||||||
|
## Kontext
|
||||||
|
|
||||||
|
`playground` soll ein Ort zum Ausprobieren sein, aber kein Ort, an dem jedes
|
||||||
|
Mal neu über Verzeichnisnamen, Include-Form und Testablage entschieden wird.
|
||||||
|
Die bestehenden Projekte `mydb` und `cxx_scaffold_cli` haben diese Fragen
|
||||||
|
bereits beantwortet.
|
||||||
|
|
||||||
|
## Entscheidung
|
||||||
|
|
||||||
|
Struktur nach P1204R0, Build- und Stilkonfiguration wörtlich von `mydb`
|
||||||
|
übernommen (`.clang-format`, `.clang-tidy`, `.clangd`, `.editorconfig`,
|
||||||
|
`CMakePresets.json`, `cmake/`), lediglich das Makro- und Target-Präfix von
|
||||||
|
`MYDB_`/`mydb_` auf `PLAYGROUND_`/`playground_` umgestellt.
|
||||||
|
|
||||||
|
Die vendorten Abhängigkeiten (Unity 2.7.0, doctest 2.5.3) wurden aus
|
||||||
|
`mydb/third_party/` kopiert statt neu geholt — damit sind die Versionen über
|
||||||
|
alle Projekte hinweg identisch.
|
||||||
|
|
||||||
|
## Konsequenzen
|
||||||
|
|
||||||
|
Ein Wechsel zwischen den Projekten kostet keine Umgewöhnung, und ein hier
|
||||||
|
erprobtes Modul lässt sich unverändert in ein anderes Projekt heben.
|
||||||
|
|
||||||
|
Der Preis ist Duplikation: eine Änderung am Hausstandard muss in jedem Repo
|
||||||
|
einzeln nachgezogen werden. Das war schon vor diesem Repo so; `cxx_scaffold_cli`
|
||||||
|
ist der Ort, an dem eine gemeinsame Vorlage entstehen müsste.
|
||||||
|
|
||||||
|
Offen bleibt, dass `docs/CONVENTIONS.md` in `mydb` ein `check_style.sh` und ein
|
||||||
|
`tools/vendor.sh` beschreibt, die in keinem der Repos existieren. In der
|
||||||
|
playground-Fassung sind diese Verweise entfernt.
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/* playground/counter.c
|
||||||
|
* Implementierung des saettigenden Zaehlers.
|
||||||
|
*/
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <playground/counter.h>
|
||||||
|
|
||||||
|
struct Counter
|
||||||
|
{
|
||||||
|
uint32_t value;
|
||||||
|
uint32_t limit;
|
||||||
|
};
|
||||||
|
|
||||||
|
Counter*
|
||||||
|
counter_create(uint32_t limit)
|
||||||
|
{
|
||||||
|
Counter* counter = malloc(sizeof(*counter));
|
||||||
|
if (!counter) return NULL;
|
||||||
|
|
||||||
|
counter->value = 0U;
|
||||||
|
counter->limit = limit;
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
counter_free(Counter* counter)
|
||||||
|
{
|
||||||
|
/* free(NULL) ist definiert -- der Aufrufer braucht keine eigene Pruefung. */
|
||||||
|
free(counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
counter_tick(Counter* counter)
|
||||||
|
{
|
||||||
|
if (counter->value < counter->limit) counter->value++;
|
||||||
|
|
||||||
|
return counter->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
counter_value(const Counter* counter)
|
||||||
|
{
|
||||||
|
return counter->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
counter_saturated(const Counter* counter)
|
||||||
|
{
|
||||||
|
return counter->value >= counter->limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
counter_reset(Counter* counter)
|
||||||
|
{
|
||||||
|
counter->value = 0U;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/* playground/counter.h
|
||||||
|
* Ein Zaehler mit saettigender Obergrenze (C).
|
||||||
|
*
|
||||||
|
* Geruest-Modul: es zeigt die C-Seite der Projektstruktur und ist dazu da,
|
||||||
|
* ersetzt zu werden. Was daran bleiben soll, ist die Form -- opakes Struct,
|
||||||
|
* Modulpraefix an jeder Funktion, extern "C" fuer die C++-Seite.
|
||||||
|
*/
|
||||||
|
#ifndef PLAYGROUND_COUNTER_H
|
||||||
|
#define PLAYGROUND_COUNTER_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Opak: das Layout geht niemanden an, die Definition steht in counter.c. */
|
||||||
|
typedef struct Counter Counter;
|
||||||
|
|
||||||
|
/* NULL, wenn kein Speicher da ist. Bei limit == 0 saettigt der Zaehler sofort. */
|
||||||
|
Counter*
|
||||||
|
counter_create(uint32_t limit);
|
||||||
|
|
||||||
|
void
|
||||||
|
counter_free(Counter* counter);
|
||||||
|
|
||||||
|
/* Erhoeht um eins und gibt den neuen Wert zurueck. Bei erreichtem Limit
|
||||||
|
* bleibt der Wert stehen -- kein Ueberlauf, kein Fehler. */
|
||||||
|
uint32_t
|
||||||
|
counter_tick(Counter* counter);
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
counter_value(const Counter* counter);
|
||||||
|
|
||||||
|
/* Nicht null, sobald das Limit erreicht ist. */
|
||||||
|
int
|
||||||
|
counter_saturated(const Counter* counter);
|
||||||
|
|
||||||
|
void
|
||||||
|
counter_reset(Counter* counter);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PLAYGROUND_COUNTER_H */
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
/* playground/counter.test.c
|
||||||
|
* Unit-Tests fuer counter (Unity).
|
||||||
|
*
|
||||||
|
* Liegt nach P1204R0 Regel 7.1 direkt neben counter.c und darf dessen Interna
|
||||||
|
* kennen. CMake baut daraus die Executable "counter.test" und registriert sie
|
||||||
|
* als CTest "unity.counter" -- genau diesen Namen erwartet der neotest-Adapter.
|
||||||
|
*/
|
||||||
|
#include <unity.h>
|
||||||
|
|
||||||
|
#include <playground/counter.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
setUp(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tearDown(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_fresh_counter_starts_at_zero(void)
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(3U);
|
||||||
|
TEST_ASSERT_NOT_NULL(counter);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(0U, counter_value(counter));
|
||||||
|
TEST_ASSERT_FALSE(counter_saturated(counter));
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_tick_increments_and_returns_new_value(void)
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(3U);
|
||||||
|
TEST_ASSERT_NOT_NULL(counter);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(1U, counter_tick(counter));
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(2U, counter_tick(counter));
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(2U, counter_value(counter));
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_counter_saturates_at_limit(void)
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(2U);
|
||||||
|
TEST_ASSERT_NOT_NULL(counter);
|
||||||
|
|
||||||
|
counter_tick(counter);
|
||||||
|
counter_tick(counter);
|
||||||
|
TEST_ASSERT_TRUE(counter_saturated(counter));
|
||||||
|
|
||||||
|
/* Weitere Ticks duerfen den Wert nicht mehr veraendern. */
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(2U, counter_tick(counter));
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(2U, counter_tick(counter));
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_limit_zero_saturates_immediately(void)
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(0U);
|
||||||
|
TEST_ASSERT_NOT_NULL(counter);
|
||||||
|
|
||||||
|
TEST_ASSERT_TRUE(counter_saturated(counter));
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(0U, counter_tick(counter));
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_reset_returns_to_zero(void)
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(5U);
|
||||||
|
TEST_ASSERT_NOT_NULL(counter);
|
||||||
|
|
||||||
|
counter_tick(counter);
|
||||||
|
counter_tick(counter);
|
||||||
|
counter_reset(counter);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(0U, counter_value(counter));
|
||||||
|
TEST_ASSERT_FALSE(counter_saturated(counter));
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
UNITY_BEGIN();
|
||||||
|
RUN_TEST(test_fresh_counter_starts_at_zero);
|
||||||
|
RUN_TEST(test_tick_increments_and_returns_new_value);
|
||||||
|
RUN_TEST(test_counter_saturates_at_limit);
|
||||||
|
RUN_TEST(test_limit_zero_saturates_immediately);
|
||||||
|
RUN_TEST(test_reset_returns_to_zero);
|
||||||
|
return UNITY_END();
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/* playground/details/bits.h
|
||||||
|
* Implementation Detail -- kleine Groessenhelfer.
|
||||||
|
*
|
||||||
|
* details/ ist nach P1204R0 die mittlere Ebene: technisch mitinstalliert und
|
||||||
|
* von anderen Uebersetzungseinheiten des Projekts benutzbar, aber ausdruecklich
|
||||||
|
* NICHT Teil der oeffentlichen API. Wer <playground/details/...> inkludiert,
|
||||||
|
* weiss damit, dass er sich auf Internes stuetzt.
|
||||||
|
*
|
||||||
|
* Die Datei ist das Beispiel fuer genau diese Ebene und wird noch von niemandem
|
||||||
|
* benutzt -- der erste echte Helfer gehoert hierher, nicht neben die
|
||||||
|
* oeffentliche API.
|
||||||
|
*/
|
||||||
|
#ifndef PLAYGROUND_DETAILS_BITS_H
|
||||||
|
#define PLAYGROUND_DETAILS_BITS_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Rundet auf das naechste Vielfache von align auf. align muss eine Zweierpotenz
|
||||||
|
* sein -- das ist der Grund fuer die Maske statt einer Division. */
|
||||||
|
static inline size_t
|
||||||
|
bits_align_up(size_t value, size_t align)
|
||||||
|
{
|
||||||
|
return (value + (align - 1U)) & ~(align - 1U);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
bits_is_power_of_two(size_t value)
|
||||||
|
{
|
||||||
|
return value != 0U && (value & (value - 1U)) == 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PLAYGROUND_DETAILS_BITS_H */
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/* playground/main.cpp
|
||||||
|
* Einstiegspunkt.
|
||||||
|
*
|
||||||
|
* Zeigt die Grenze zwischen beiden Sprachen: der Counter kommt aus C und wird
|
||||||
|
* ueber den extern "C"-Header benutzt, das Notebook ist C++. Beide werden mit
|
||||||
|
* Projektpraefix und spitzen Klammern inkludiert -- P1204R0s wichtigste
|
||||||
|
* Einzelregel.
|
||||||
|
*/
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <exception>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <playground/counter.h>
|
||||||
|
#include <playground/notebook.hpp>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
int
|
||||||
|
demo()
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(3U);
|
||||||
|
if (!counter)
|
||||||
|
{
|
||||||
|
std::fputs("counter_create failed\n", stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
playground::Notebook notebook;
|
||||||
|
|
||||||
|
/* Ticken, bis der Zaehler saettigt, und jeden Schritt protokollieren. */
|
||||||
|
for (int step = 0; step < 5; ++step)
|
||||||
|
{
|
||||||
|
const std::uint32_t value = counter_tick(counter);
|
||||||
|
notebook.append("tick", std::to_string(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& entry : notebook.entries())
|
||||||
|
{
|
||||||
|
std::printf("%s: %s\n", entry.label.c_str(), entry.text.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto last = notebook.latest("tick");
|
||||||
|
std::printf("saturated: %s, letzter Wert: %s\n", counter_saturated(counter) ? "ja" : "nein",
|
||||||
|
last ? std::string(*last).c_str() : "-");
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace */
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
/* main darf nichts nach aussen werfen (bugprone-exception-escape): das
|
||||||
|
* Notebook allokiert, und eine entwichene Exception waere ein
|
||||||
|
* std::terminate ohne verwertbare Meldung. */
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return demo();
|
||||||
|
}
|
||||||
|
catch (const std::exception& error)
|
||||||
|
{
|
||||||
|
std::fprintf(stderr, "playground: %s\n", error.what());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::fputs("playground: unbekannter Fehler\n", stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/* playground/notebook.cpp
|
||||||
|
* Implementierung des Notizbuchs.
|
||||||
|
*/
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <playground/notebook.hpp>
|
||||||
|
|
||||||
|
namespace playground
|
||||||
|
{
|
||||||
|
|
||||||
|
void
|
||||||
|
Notebook::append(std::string_view label, std::string_view text)
|
||||||
|
{
|
||||||
|
items.push_back(Entry{std::string(label), std::string(text)});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string_view>
|
||||||
|
Notebook::latest(std::string_view label) const
|
||||||
|
{
|
||||||
|
/* Von hinten, damit der juengste Eintrag gewinnt -- ein Vorwaertslauf
|
||||||
|
* muesste bis zum Ende weitersuchen, um dasselbe zu liefern. */
|
||||||
|
for (auto it = items.rbegin(); it != items.rend(); ++it)
|
||||||
|
{
|
||||||
|
if (it->label == label) return std::string_view{it->text};
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<Notebook::Entry>&
|
||||||
|
Notebook::entries() const noexcept
|
||||||
|
{
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
Notebook::size() const noexcept
|
||||||
|
{
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Notebook::clear() noexcept
|
||||||
|
{
|
||||||
|
items.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace playground */
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/* playground/notebook.hpp
|
||||||
|
* Ein Notizbuch: beschriftete Textschnipsel in Einfuegereihenfolge (C++).
|
||||||
|
*
|
||||||
|
* Geruest-Modul fuer die C++-Seite. Gleicher Stil, gleiche Klammern, gleiche
|
||||||
|
* Kommentarform wie im C-Teil -- der Unterschied ist allein die Extension.
|
||||||
|
*/
|
||||||
|
#ifndef PLAYGROUND_NOTEBOOK_HPP
|
||||||
|
#define PLAYGROUND_NOTEBOOK_HPP
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace playground
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Namespace heisst playground, das Verzeichnis heisst playground, Makros
|
||||||
|
* heissen PLAYGROUND_* -- so kollidiert nichts mit anderen Projekten. */
|
||||||
|
class Notebook
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct Entry
|
||||||
|
{
|
||||||
|
std::string label;
|
||||||
|
std::string text;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Haengt hinten an. Anders als bei Registry in mydb sind doppelte Label
|
||||||
|
* erlaubt -- ein Notizbuch protokolliert, es indiziert nicht. */
|
||||||
|
void
|
||||||
|
append(std::string_view label, std::string_view text);
|
||||||
|
|
||||||
|
/* nullopt, wenn kein Eintrag dieses Label traegt. Bei Mehrfachvergabe
|
||||||
|
* gewinnt der ZULETZT angehaengte.
|
||||||
|
*
|
||||||
|
* Die zurueckgegebene View zeigt in das Notizbuch: sie gilt nur so lange,
|
||||||
|
* wie das Notizbuch lebt und nicht veraendert wird. */
|
||||||
|
std::optional<std::string_view>
|
||||||
|
latest(std::string_view label) const;
|
||||||
|
|
||||||
|
const std::vector<Entry>&
|
||||||
|
entries() const noexcept;
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
size() const noexcept;
|
||||||
|
|
||||||
|
void
|
||||||
|
clear() noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* Kein m_-Praefix und kein abschliessender Unterstrich -- so wie im
|
||||||
|
* restlichen Projekt. */
|
||||||
|
std::vector<Entry> items;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace playground */
|
||||||
|
|
||||||
|
#endif /* PLAYGROUND_NOTEBOOK_HPP */
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/* playground/notebook.test.cpp
|
||||||
|
* Unit-Tests fuer Notebook (doctest).
|
||||||
|
*
|
||||||
|
* Liegt nach P1204R0 Regel 7.1 neben notebook.cpp. CMake baut daraus die
|
||||||
|
* Executable "notebook.test" und laesst doctest_discover_tests() darauf los --
|
||||||
|
* das legt pro TEST_CASE einen eigenen CTest-Eintrag an, was neotest braucht,
|
||||||
|
* um einzelne Faelle rot bzw. gruen zu faerben.
|
||||||
|
*/
|
||||||
|
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||||
|
#include <doctest/doctest.h>
|
||||||
|
|
||||||
|
#include <playground/notebook.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("a fresh notebook is empty")
|
||||||
|
{
|
||||||
|
const playground::Notebook notebook;
|
||||||
|
|
||||||
|
CHECK(notebook.size() == 0U);
|
||||||
|
CHECK(notebook.entries().empty());
|
||||||
|
CHECK_FALSE(notebook.latest("nothing").has_value());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("append stores label and text in order")
|
||||||
|
{
|
||||||
|
playground::Notebook notebook;
|
||||||
|
notebook.append("first", "eins");
|
||||||
|
notebook.append("second", "zwei");
|
||||||
|
|
||||||
|
REQUIRE(notebook.size() == 2U);
|
||||||
|
CHECK(notebook.entries()[0].label == "first");
|
||||||
|
CHECK(notebook.entries()[1].text == "zwei");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("latest returns the most recent entry for a repeated label")
|
||||||
|
{
|
||||||
|
playground::Notebook notebook;
|
||||||
|
notebook.append("note", "alt");
|
||||||
|
notebook.append("other", "dazwischen");
|
||||||
|
notebook.append("note", "neu");
|
||||||
|
|
||||||
|
const auto found = notebook.latest("note");
|
||||||
|
REQUIRE(found.has_value());
|
||||||
|
CHECK(*found == "neu");
|
||||||
|
|
||||||
|
/* Der aeltere Eintrag bleibt erhalten, er wird nur nicht gefunden. */
|
||||||
|
CHECK(notebook.size() == 3U);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("clear empties the notebook")
|
||||||
|
{
|
||||||
|
playground::Notebook notebook;
|
||||||
|
notebook.append("a", "1");
|
||||||
|
notebook.append("b", "2");
|
||||||
|
REQUIRE(notebook.size() == 2U);
|
||||||
|
|
||||||
|
notebook.clear();
|
||||||
|
|
||||||
|
CHECK(notebook.size() == 0U);
|
||||||
|
CHECK_FALSE(notebook.latest("a").has_value());
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Integrationstests (P1204R0 Regel 7.2).
|
||||||
|
#
|
||||||
|
# Unterschied zu den Unit-Tests neben den Modulen: diese hier benutzen
|
||||||
|
# ausschliesslich die OEFFENTLICHE API -- also <playground/...> und sonst
|
||||||
|
# nichts. Damit testen sie genau das, was ein Benutzer bekommt, und koennten
|
||||||
|
# im Prinzip auch gegen eine installierte Version laufen.
|
||||||
|
#
|
||||||
|
# Jedes Unterverzeichnis ist ein eigener Testfall mit eigener driver.c/.cpp.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function(playground_add_integration_test name)
|
||||||
|
set(target "integration_${name}")
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${name}/driver.c")
|
||||||
|
add_executable(${target} "${name}/driver.c")
|
||||||
|
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${name}/driver.cpp")
|
||||||
|
add_executable(${target} "${name}/driver.cpp")
|
||||||
|
else()
|
||||||
|
message(WARNING "tests/${name}: keine driver.c/.cpp gefunden")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${target} PRIVATE playground_core playground_warnings)
|
||||||
|
add_test(NAME "integration.${name}" COMMAND ${target})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
playground_add_integration_test(basics)
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/* tests/basics/driver.cpp
|
||||||
|
* Integrationstest (P1204R0 Regel 7.2).
|
||||||
|
*
|
||||||
|
* Unterschied zu den .test-Dateien neben den Modulen: dieser Test kennt NUR
|
||||||
|
* die oeffentliche API. Kein unity.h, kein doctest.h, kein Zugriff auf
|
||||||
|
* details/, keine Kenntnis vom Layout. Er wuerde genauso gegen eine
|
||||||
|
* installierte Bibliothek laufen -- und testet damit das, was ein Benutzer
|
||||||
|
* tatsaechlich bekommt.
|
||||||
|
*
|
||||||
|
* Deshalb auch kein Test-Framework: ein Integrationstest soll ein
|
||||||
|
* eigenstaendiges Programm sein, das ohne Argumente laeuft und ueber seinen
|
||||||
|
* Exit-Code Auskunft gibt.
|
||||||
|
*/
|
||||||
|
#include <cstdio>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <playground/counter.h>
|
||||||
|
#include <playground/notebook.hpp>
|
||||||
|
|
||||||
|
#define CHECK(cond) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (!(cond)) \
|
||||||
|
{ \
|
||||||
|
std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Beide Module zusammen: der C-Zaehler treibt, das C++-Notizbuch protokolliert.
|
||||||
|
* Genau diese Kombination ist das, was main.cpp einem Benutzer vormacht. */
|
||||||
|
int
|
||||||
|
counter_drives_notebook_until_saturation()
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(3U);
|
||||||
|
CHECK(counter != nullptr);
|
||||||
|
|
||||||
|
playground::Notebook notebook;
|
||||||
|
|
||||||
|
for (int step = 0; step < 5; ++step)
|
||||||
|
{
|
||||||
|
notebook.append("tick", std::to_string(counter_tick(counter)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fuenf Ticks, aber Limit 3: der Zaehler steht, das Protokoll nicht. */
|
||||||
|
CHECK(notebook.size() == 5U);
|
||||||
|
CHECK(counter_value(counter) == 3U);
|
||||||
|
CHECK(counter_saturated(counter));
|
||||||
|
|
||||||
|
const auto last = notebook.latest("tick");
|
||||||
|
CHECK(last.has_value());
|
||||||
|
CHECK(*last == "3");
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
reset_makes_the_counter_usable_again()
|
||||||
|
{
|
||||||
|
Counter* counter = counter_create(2U);
|
||||||
|
CHECK(counter != nullptr);
|
||||||
|
|
||||||
|
counter_tick(counter);
|
||||||
|
counter_tick(counter);
|
||||||
|
CHECK(counter_saturated(counter));
|
||||||
|
|
||||||
|
counter_reset(counter);
|
||||||
|
CHECK(!counter_saturated(counter));
|
||||||
|
CHECK(counter_tick(counter) == 1U);
|
||||||
|
|
||||||
|
counter_free(counter);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace */
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if (counter_drives_notebook_until_saturation() != 0) return 1;
|
||||||
|
if (reset_makes_the_counter_usable_again() != 0) return 1;
|
||||||
|
|
||||||
|
std::puts("integration/basics: ok");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Vendored
+50
@@ -0,0 +1,50 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Vendorter Fremdcode.
|
||||||
|
#
|
||||||
|
# Bewusst NICHT ueber FetchContent/CPM: die Dateien liegen als lesbarer Quellcode
|
||||||
|
# im Repo, der Build braucht kein Netz, und auf dem Ubuntu-Server gibt es keine
|
||||||
|
# Ueberraschung. Die Dateien werden von Hand aktualisiert, siehe VERSIONS.
|
||||||
|
#
|
||||||
|
# Zwei Dinge gelten hier anders als im restlichen Projekt:
|
||||||
|
# * SYSTEM-Includes -- Warnungen aus fremden Headern interessieren uns nicht.
|
||||||
|
# * KEIN playground_warnings -- -Wconversion auf unity.c ergibt nur Rauschen.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ---- Unity (C) ------------------------------------------------------------
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/unity/unity.c")
|
||||||
|
add_library(unity STATIC unity/unity.c)
|
||||||
|
|
||||||
|
target_include_directories(unity SYSTEM PUBLIC
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/unity")
|
||||||
|
|
||||||
|
# Unity gibt pro Test eine Zeile "<datei>:<zeile>:<testname>:PASS|FAIL:" aus.
|
||||||
|
# Genau dieses Format parst der neotest-unity-Adapter, um einzelne Tests
|
||||||
|
# rot/gruen zu faerben -- CTest selbst kennt nur die ganze Executable.
|
||||||
|
#
|
||||||
|
# UNITY_OUTPUT_COLOR wird hier NICHT definiert: Unity prueft nur, OB das
|
||||||
|
# Makro definiert ist, nicht welchen Wert es hat. "UNITY_OUTPUT_COLOR=0"
|
||||||
|
# schaltet die Farben also ein und schiebt ANSI-Sequenzen mitten in die
|
||||||
|
# PASS/FAIL-Zeilen.
|
||||||
|
target_compile_definitions(unity PUBLIC UNITY_INCLUDE_DOUBLE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ---- doctest (C++) --------------------------------------------------------
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doctest/doctest.h")
|
||||||
|
add_library(doctest INTERFACE)
|
||||||
|
|
||||||
|
target_include_directories(doctest SYSTEM INTERFACE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# doctest_discover_tests(). Ruft die Test-Executable beim Build mit
|
||||||
|
# --list-test-cases auf und legt EINEN CTest-Eintrag pro TEST_CASE an.
|
||||||
|
# Ohne das sieht neotest-ctest nur einen einzigen groben Eintrag und kann
|
||||||
|
# keine Testnamen auf Quellzeilen abbilden.
|
||||||
|
#
|
||||||
|
# function() ist in CMake global sichtbar, sobald sie einmal definiert
|
||||||
|
# wurde -- der Aufruf im uebergeordneten CMakeLists.txt funktioniert also.
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doctest/doctest.cmake")
|
||||||
|
include("${CMAKE_CURRENT_SOURCE_DIR}/doctest/doctest.cmake")
|
||||||
|
else()
|
||||||
|
message(WARNING "doctest/doctest.cmake fehlt -- siehe third_party/README.md")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
# third_party
|
||||||
|
|
||||||
|
Vendored, unmodified upstream sources. **Do not edit these files.**
|
||||||
|
|
||||||
|
They are excluded from:
|
||||||
|
|
||||||
|
- the formatter (`conform.nvim` skips `third_party/`)
|
||||||
|
- clangd diagnostics and clang-tidy (`.clangd` `PathMatch` fragment)
|
||||||
|
- the project's warning flags (`third_party/CMakeLists.txt` does not link
|
||||||
|
`playground_warnings`, and includes are marked `SYSTEM`)
|
||||||
|
|
||||||
|
To update, replace the files with fresh upstream releases, bump `VERSIONS`,
|
||||||
|
and review the diff. There is no vendor.sh yet.
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
# Vendored dependencies. Copied from ../mydb/third_party/ on 2026-08-30;
|
||||||
|
# there is no vendor.sh in any of these repos yet.
|
||||||
|
# Vendored on 2026-08-18T07:48:51Z
|
||||||
|
|
||||||
|
ThrowTheSwitch/Unity v2.7.0 src/unity.{c,h}, src/unity_internals.h
|
||||||
|
doctest/doctest v2.5.3 doctest/doctest.h, scripts/cmake/doctest.cmake
|
||||||
Vendored
+191
@@ -0,0 +1,191 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License.
|
||||||
|
# See https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
doctest
|
||||||
|
-----
|
||||||
|
|
||||||
|
This module defines a function to help use the doctest test framework.
|
||||||
|
|
||||||
|
The :command:`doctest_discover_tests` discovers tests by asking the compiled test
|
||||||
|
executable to enumerate its tests. This does not require CMake to be re-run
|
||||||
|
when tests change. However, it may not work in a cross-compiling environment,
|
||||||
|
and setting test properties is less convenient.
|
||||||
|
|
||||||
|
This command is intended to replace use of :command:`add_test` to register
|
||||||
|
tests, and will create a separate CTest test for each doctest test case. Note
|
||||||
|
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||||
|
cannot be shared by multiple test cases executing in the same instance.
|
||||||
|
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||||
|
usually considered as more beneficial. By default, the CTest test name is the
|
||||||
|
same as the doctest name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||||
|
|
||||||
|
.. command:: doctest_discover_tests
|
||||||
|
|
||||||
|
Automatically add tests with CTest by querying the compiled test executable
|
||||||
|
for available tests::
|
||||||
|
|
||||||
|
doctest_discover_tests(target
|
||||||
|
[TEST_SPEC arg1...]
|
||||||
|
[EXTRA_ARGS arg1...]
|
||||||
|
[WORKING_DIRECTORY dir]
|
||||||
|
[TEST_PREFIX prefix]
|
||||||
|
[TEST_SUFFIX suffix]
|
||||||
|
[PROPERTIES name1 value1...]
|
||||||
|
[ADD_LABELS value]
|
||||||
|
[TEST_LIST var]
|
||||||
|
[JUNIT_OUTPUT_DIR dir]
|
||||||
|
)
|
||||||
|
|
||||||
|
``doctest_discover_tests`` sets up a post-build command on the test executable
|
||||||
|
that generates the list of tests by parsing the output from running the test
|
||||||
|
with the ``--list-test-cases`` argument. This ensures that the full
|
||||||
|
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||||
|
not necessary to re-run CMake when the list of tests changes.
|
||||||
|
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||||
|
in order to function in a cross-compiling environment.
|
||||||
|
|
||||||
|
Additionally, setting properties on tests is somewhat less convenient, since
|
||||||
|
the tests are not available at CMake time. Additional test properties may be
|
||||||
|
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||||
|
more fine-grained test control is needed, custom content may be provided
|
||||||
|
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||||
|
directory property. The set of discovered tests is made accessible to such a
|
||||||
|
script via the ``<target>_TESTS`` variable.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``target``
|
||||||
|
Specifies the doctest executable, which must be a known CMake executable
|
||||||
|
target. CMake will substitute the location of the built executable when
|
||||||
|
running the test.
|
||||||
|
|
||||||
|
``TEST_SPEC arg1...``
|
||||||
|
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||||
|
pass to the doctest executable with the ``--list-test-cases`` argument.
|
||||||
|
|
||||||
|
``EXTRA_ARGS arg1...``
|
||||||
|
Any extra arguments to pass on the command line to each test case.
|
||||||
|
|
||||||
|
``WORKING_DIRECTORY dir``
|
||||||
|
Specifies the directory in which to run the discovered test cases. If this
|
||||||
|
option is not provided, the current binary directory is used.
|
||||||
|
|
||||||
|
``TEST_PREFIX prefix``
|
||||||
|
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||||
|
case. This can be useful when the same test executable is being used in
|
||||||
|
multiple calls to ``doctest_discover_tests()`` but with different
|
||||||
|
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||||
|
|
||||||
|
``TEST_SUFFIX suffix``
|
||||||
|
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||||
|
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||||
|
be specified.
|
||||||
|
|
||||||
|
``PROPERTIES name1 value1...``
|
||||||
|
Specifies additional properties to be set on all tests discovered by this
|
||||||
|
invocation of ``doctest_discover_tests``.
|
||||||
|
|
||||||
|
``ADD_LABELS value``
|
||||||
|
Specifies if the test labels should be set automatically.
|
||||||
|
|
||||||
|
``TEST_LIST var``
|
||||||
|
Make the list of tests available in the variable ``var``, rather than the
|
||||||
|
default ``<target>_TESTS``. This can be useful when the same test
|
||||||
|
executable is being used in multiple calls to ``doctest_discover_tests()``.
|
||||||
|
Note that this variable is only available in CTest.
|
||||||
|
|
||||||
|
``JUNIT_OUTPUT_DIR dir``
|
||||||
|
If specified, the parameter is passed along with ``--reporters=junit``
|
||||||
|
and ``--out=`` to the test executable. The actual file name is the same
|
||||||
|
as the test target, including prefix and suffix. This should be used
|
||||||
|
instead of EXTRA_ARGS to avoid race conditions writing the XML result
|
||||||
|
output when using parallel test execution.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
function(doctest_discover_tests TARGET)
|
||||||
|
cmake_parse_arguments(
|
||||||
|
""
|
||||||
|
""
|
||||||
|
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;JUNIT_OUTPUT_DIR"
|
||||||
|
"TEST_SPEC;EXTRA_ARGS;PROPERTIES;ADD_LABELS"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _WORKING_DIRECTORY)
|
||||||
|
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
if(NOT _TEST_LIST)
|
||||||
|
set(_TEST_LIST ${TARGET}_TESTS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## Generate a unique name based on the extra arguments
|
||||||
|
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||||
|
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||||
|
|
||||||
|
# Define rule to generate test list for aforementioned test executable
|
||||||
|
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||||
|
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||||
|
get_property(crosscompiling_emulator
|
||||||
|
TARGET ${TARGET}
|
||||||
|
PROPERTY CROSSCOMPILING_EMULATOR
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET} POST_BUILD
|
||||||
|
BYPRODUCTS "${ctest_tests_file}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "TEST_TARGET=${TARGET}"
|
||||||
|
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||||
|
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||||
|
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||||
|
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||||
|
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||||
|
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||||
|
-D "TEST_ADD_LABELS=${_ADD_LABELS}"
|
||||||
|
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||||
|
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||||
|
-D "TEST_LIST=${_TEST_LIST}"
|
||||||
|
-D "TEST_JUNIT_OUTPUT_DIR=${_JUNIT_OUTPUT_DIR}"
|
||||||
|
-D "CTEST_FILE=${ctest_tests_file}"
|
||||||
|
-P "${_DOCTEST_DISCOVER_TESTS_SCRIPT}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
file(WRITE "${ctest_include_file}"
|
||||||
|
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||||
|
" include(\"${ctest_tests_file}\")\n"
|
||||||
|
"else()\n"
|
||||||
|
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||||
|
"endif()\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT CMAKE_VERSION VERSION_LESS 3.10)
|
||||||
|
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||||
|
set_property(DIRECTORY
|
||||||
|
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||||
|
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||||
|
if(NOT ${test_include_file_set})
|
||||||
|
set_property(DIRECTORY
|
||||||
|
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
set(_DOCTEST_DISCOVER_TESTS_SCRIPT
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/doctestAddTests.cmake
|
||||||
|
CACHE INTERNAL "The location of the doctestAddTests script"
|
||||||
|
)
|
||||||
|
mark_as_advanced(_DOCTEST_DISCOVER_TESTS_SCRIPT)
|
||||||
Vendored
+9148
File diff suppressed because it is too large
Load Diff
+120
@@ -0,0 +1,120 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License.
|
||||||
|
# See https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
set(prefix "${TEST_PREFIX}")
|
||||||
|
set(suffix "${TEST_SUFFIX}")
|
||||||
|
set(spec ${TEST_SPEC})
|
||||||
|
set(extra_args ${TEST_EXTRA_ARGS})
|
||||||
|
set(properties ${TEST_PROPERTIES})
|
||||||
|
set(add_labels ${TEST_ADD_LABELS})
|
||||||
|
set(junit_output_dir "${TEST_JUNIT_OUTPUT_DIR}")
|
||||||
|
set(script)
|
||||||
|
set(suite)
|
||||||
|
set(tests)
|
||||||
|
|
||||||
|
function(add_command NAME)
|
||||||
|
set(_args "")
|
||||||
|
foreach(_arg ${ARGN})
|
||||||
|
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||||
|
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||||
|
else()
|
||||||
|
set(_args "${_args} ${_arg}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Run test executable to get list of available tests
|
||||||
|
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if("${spec}" MATCHES .)
|
||||||
|
set(spec "--test-case=${spec}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-cases
|
||||||
|
OUTPUT_VARIABLE output
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||||
|
)
|
||||||
|
if(NOT ${result} EQUAL 0)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||||
|
" Result: ${result}\n"
|
||||||
|
" Output: ${output}\n"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" output "${output}")
|
||||||
|
|
||||||
|
# Parse output
|
||||||
|
foreach(line ${output})
|
||||||
|
if("${line}" STREQUAL "===============================================================================" OR "${line}" MATCHES [==[^\[doctest\] ]==])
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
set(test ${line})
|
||||||
|
set(labels "")
|
||||||
|
if(${add_labels})
|
||||||
|
# get test suite that test belongs to
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" --test-case=${test} --list-test-suites
|
||||||
|
OUTPUT_VARIABLE labeloutput
|
||||||
|
RESULT_VARIABLE labelresult
|
||||||
|
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||||
|
)
|
||||||
|
if(NOT ${labelresult} EQUAL 0)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||||
|
" Result: ${labelresult}\n"
|
||||||
|
" Output: ${labeloutput}\n"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" labeloutput "${labeloutput}")
|
||||||
|
foreach(labelline ${labeloutput})
|
||||||
|
if("${labelline}" STREQUAL "===============================================================================" OR "${labelline}" MATCHES [==[^\[doctest\] ]==])
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
list(APPEND labels ${labelline})
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT "${junit_output_dir}" STREQUAL "")
|
||||||
|
# turn testname into a valid filename by replacing all special characters with "-"
|
||||||
|
string(REGEX REPLACE "[/\\:\"|<>]" "-" test_filename "${test}")
|
||||||
|
set(TEST_JUNIT_OUTPUT_PARAM "--reporters=junit" "--out=${junit_output_dir}/${prefix}${test_filename}${suffix}.xml")
|
||||||
|
else()
|
||||||
|
unset(TEST_JUNIT_OUTPUT_PARAM)
|
||||||
|
endif()
|
||||||
|
# use escape commas to handle properly test cases with commas inside the name
|
||||||
|
string(REPLACE "," "\\," test_name ${test})
|
||||||
|
# ...and add to script
|
||||||
|
add_command(add_test
|
||||||
|
"${prefix}${test}${suffix}"
|
||||||
|
${TEST_EXECUTOR}
|
||||||
|
"${TEST_EXECUTABLE}"
|
||||||
|
"--test-case=${test_name}"
|
||||||
|
"${TEST_JUNIT_OUTPUT_PARAM}"
|
||||||
|
${extra_args}
|
||||||
|
)
|
||||||
|
add_command(set_tests_properties
|
||||||
|
"${prefix}${test}${suffix}"
|
||||||
|
PROPERTIES
|
||||||
|
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||||
|
${properties}
|
||||||
|
LABELS ${labels}
|
||||||
|
)
|
||||||
|
unset(labels)
|
||||||
|
list(APPEND tests "${prefix}${test}${suffix}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Create a list of all discovered tests, which users may use to e.g. set
|
||||||
|
# properties on the tests
|
||||||
|
add_command(set ${TEST_LIST} ${tests})
|
||||||
|
|
||||||
|
# Write CTest script
|
||||||
|
file(WRITE "${CTEST_FILE}" "${script}")
|
||||||
Vendored
+2840
File diff suppressed because it is too large
Load Diff
Vendored
+710
@@ -0,0 +1,710 @@
|
|||||||
|
/* =========================================================================
|
||||||
|
Unity - A Test Framework for C
|
||||||
|
ThrowTheSwitch.org
|
||||||
|
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||||
|
SPDX-License-Identifier: MIT
|
||||||
|
========================================================================= */
|
||||||
|
|
||||||
|
#ifndef UNITY_FRAMEWORK_H
|
||||||
|
#define UNITY_FRAMEWORK_H
|
||||||
|
#define UNITY
|
||||||
|
|
||||||
|
#define UNITY_VERSION_MAJOR 2
|
||||||
|
#define UNITY_VERSION_MINOR 7
|
||||||
|
#define UNITY_VERSION_BUILD 0
|
||||||
|
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "unity_internals.h"
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Setup / Teardown
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* These functions are intended to be called before and after each test.
|
||||||
|
* If using unity directly, these will need to be provided for each test
|
||||||
|
* executable built. If you are using the test runner generator and/or
|
||||||
|
* Ceedling, these are optional. */
|
||||||
|
void setUp(void);
|
||||||
|
void tearDown(void);
|
||||||
|
|
||||||
|
/* These functions are intended to be called at the beginning and end of an
|
||||||
|
* entire test suite. suiteTearDown() is passed the number of tests that
|
||||||
|
* failed, and its return value becomes the exit code of main(). If using
|
||||||
|
* Unity directly, you're in charge of calling these if they are desired.
|
||||||
|
* If using Ceedling or the test runner generator, these will be called
|
||||||
|
* automatically if they exist. */
|
||||||
|
void suiteSetUp(void);
|
||||||
|
int suiteTearDown(int num_failures);
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Reset and Verify
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* These functions are intended to be called before or during tests in order
|
||||||
|
* to support complex test loops, etc. Both are NOT built into Unity. Instead
|
||||||
|
* the test runner generator will create them. resetTest will run teardown and
|
||||||
|
* setup again, verifying any end-of-test needs between. verifyTest will only
|
||||||
|
* run the verification. */
|
||||||
|
void resetTest(void);
|
||||||
|
void verifyTest(void);
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Configuration Options
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* All options described below should be passed as a compiler flag to all files using Unity. If you must add #defines, place them BEFORE the #include above.
|
||||||
|
|
||||||
|
* Integers/longs/pointers
|
||||||
|
* - Unity attempts to automatically discover your integer sizes
|
||||||
|
* - define UNITY_EXCLUDE_STDINT_H to stop attempting to look in <stdint.h>
|
||||||
|
* - define UNITY_EXCLUDE_LIMITS_H to stop attempting to look in <limits.h>
|
||||||
|
* - If you cannot use the automatic methods above, you can force Unity by using these options:
|
||||||
|
* - define UNITY_SUPPORT_64
|
||||||
|
* - set UNITY_INT_WIDTH
|
||||||
|
* - set UNITY_LONG_WIDTH
|
||||||
|
* - set UNITY_POINTER_WIDTH
|
||||||
|
|
||||||
|
* Floats
|
||||||
|
* - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons
|
||||||
|
* - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT
|
||||||
|
* - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats
|
||||||
|
* - define UNITY_INCLUDE_DOUBLE to allow double floating point comparisons
|
||||||
|
* - define UNITY_EXCLUDE_DOUBLE to disallow double floating point comparisons (default)
|
||||||
|
* - define UNITY_DOUBLE_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_DOUBLE
|
||||||
|
* - define UNITY_DOUBLE_TYPE to specify something other than double
|
||||||
|
* - define UNITY_EXCLUDE_FLOAT_PRINT to trim binary size, won't print floating point values in errors
|
||||||
|
|
||||||
|
* Output
|
||||||
|
* - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired
|
||||||
|
* - define UNITY_DIFFERENTIATE_FINAL_FAIL to print FAILED (vs. FAIL) at test end summary - for automated search for failure
|
||||||
|
|
||||||
|
* Optimization
|
||||||
|
* - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge
|
||||||
|
* - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests.
|
||||||
|
|
||||||
|
* Test Cases
|
||||||
|
* - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script
|
||||||
|
|
||||||
|
* Parameterized Tests
|
||||||
|
* - you'll want to create a define of TEST_CASE(...), TEST_RANGE(...) and/or TEST_MATRIX(...) which basically evaluates to nothing
|
||||||
|
|
||||||
|
* Tests with Arguments
|
||||||
|
* - you'll want to define UNITY_USE_COMMAND_LINE_ARGS if you have the test runner passing arguments to Unity
|
||||||
|
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* Basic Fail and Ignore
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, (message))
|
||||||
|
#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL)
|
||||||
|
#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, (message))
|
||||||
|
#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL)
|
||||||
|
#define TEST_MESSAGE(message) UnityMessage((message), __LINE__)
|
||||||
|
#define TEST_ONLY()
|
||||||
|
#ifdef UNITY_INCLUDE_PRINT_FORMATTED
|
||||||
|
#define TEST_PRINTF(message, ...) UnityPrintF(__LINE__, (message), ##__VA_ARGS__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails.
|
||||||
|
* This method allows you to abort a test immediately with a PASS state, ignoring the remainder of the test. */
|
||||||
|
#define TEST_PASS() TEST_ABORT()
|
||||||
|
#define TEST_PASS_MESSAGE(message) do { UnityMessage((message), __LINE__); TEST_ABORT(); } while (0)
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Build Directives
|
||||||
|
*-------------------------------------------------------
|
||||||
|
|
||||||
|
* These macros do nothing, but they are useful for additional build context.
|
||||||
|
* Tools (like Ceedling) can scan for these directives and make use of them for
|
||||||
|
* per-test-executable #include search paths and linking. */
|
||||||
|
|
||||||
|
/* Add source files to a test executable's compilation and linking. Ex: TEST_SOURCE_FILE("sandwiches.c") */
|
||||||
|
#define TEST_SOURCE_FILE(a)
|
||||||
|
|
||||||
|
/* Customize #include search paths for a test executable's compilation. Ex: TEST_INCLUDE_PATH("src/module_a/inc") */
|
||||||
|
#define TEST_INCLUDE_PATH(a)
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Asserts (simple)
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Boolean */
|
||||||
|
#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE")
|
||||||
|
#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE")
|
||||||
|
#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE")
|
||||||
|
#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE")
|
||||||
|
#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL")
|
||||||
|
#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL")
|
||||||
|
#define TEST_ASSERT_EMPTY(pointer) UNITY_TEST_ASSERT_EMPTY( (pointer), __LINE__, " Expected Empty")
|
||||||
|
#define TEST_ASSERT_NOT_EMPTY(pointer) UNITY_TEST_ASSERT_NOT_EMPTY((pointer), __LINE__, " Expected Non-Empty")
|
||||||
|
|
||||||
|
/* Integers (of all sizes) */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_size_t(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_CHAR(expected, actual) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT)(-1), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT)(0), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT)1 << (bit)), (UNITY_UINT)(-1), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT)1 << (bit)), (UNITY_UINT)(0), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Integer Not Equal To (of all sizes) */
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT8(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT16(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT32(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT64(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT8(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_size_t(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_CHAR((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Integer Greater Than/ Less Than (of all sizes) */
|
||||||
|
#define TEST_ASSERT_GREATER_THAN(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_size_t(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_CHAR(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_CHAR((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_THAN(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_size_t(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_CHAR(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_CHAR((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_size_t(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_size_t(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Integer Ranges (of all sizes) */
|
||||||
|
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_size_t_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_CHAR_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_CHAR_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Integer Array Ranges (of all sizes) */
|
||||||
|
#define TEST_ASSERT_INT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_size_t_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_CHAR_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||||
|
|
||||||
|
|
||||||
|
/* Structs and Strings */
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Structs and Strings Not Equal To */
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_NOT_EQUAL_PTR((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_NOT_EQUAL_STRING((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_STRING_LEN(expected, actual, len) UNITY_TEST_ASSERT_NOT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_NOT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Arrays */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_size_t_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_CHAR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Arrays Compared To Single Value */
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_size_t(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_PTR((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_STRING(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_STRING((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_MEMORY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY((expected), (actual), (len), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_CHAR(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_CHAR((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Floating Point (If Enabled) */
|
||||||
|
#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_NOT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_NOT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_NOT_EQUAL_FLOAT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_FLOAT_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_FLOAT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_FLOAT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_FLOAT(threshold, actual) UNITY_TEST_ASSERT_LESS_THAN_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_FLOAT(threshold, actual) UNITY_TEST_ASSERT_LESS_OR_EQUAL_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NEG_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NAN(actual) UNITY_TEST_ASSERT_FLOAT_IS_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_DETERMINATE(actual) UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Double (If Enabled) */
|
||||||
|
#define TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_NOT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_NOT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_EQUAL_DOUBLE((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_NOT_EQUAL_DOUBLE((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_DOUBLE_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_LESS_THAN_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_LESS_OR_EQUAL_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NEG_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Shorthand */
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_OLD
|
||||||
|
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_INT
|
||||||
|
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_MEM
|
||||||
|
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_MEMORY((&expected), (&actual), sizeof(expected), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_RAW
|
||||||
|
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) == (actual)), __LINE__, " Expected Equal")
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_NONE
|
||||||
|
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Asserts (with additional messages)
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Boolean */
|
||||||
|
#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EMPTY_MESSAGE(pointer, message) UNITY_TEST_ASSERT_EMPTY( (pointer), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EMPTY_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_EMPTY((pointer), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integers (of all sizes) */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_size_t_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(0), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_CHAR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integer Not Equal To (of all sizes) */
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_CHAR((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
|
||||||
|
/* Integer Greater Than/ Less Than (of all sizes) */
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_CHAR((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_CHAR((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integer Ranges (of all sizes) */
|
||||||
|
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_size_t_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_CHAR_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_CHAR_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integer Array Ranges (of all sizes) */
|
||||||
|
#define TEST_ASSERT_INT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_size_t_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_CHAR_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||||
|
|
||||||
|
|
||||||
|
/* Structs and Strings */
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Structs and Strings Not Equal To */
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_PTR((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_STRING((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_NOT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_NOT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Arrays */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_size_t_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_CHAR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Arrays Compared To Single Value*/
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT8((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT16((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT64((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT8((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT16((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT64((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_size_t_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX8((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX16((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX64((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_PTR_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_PTR((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_STRING_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_STRING((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_MEMORY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY((expected), (actual), (len), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_CHAR_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_CHAR((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Floating Point (If Enabled) */
|
||||||
|
#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_FLOAT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_FLOAT_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_FLOAT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_FLOAT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_FLOAT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_THAN_FLOAT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_OR_EQUAL_FLOAT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Double (If Enabled) */
|
||||||
|
#define TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_DOUBLE_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_DOUBLE((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_DOUBLE_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_DOUBLE_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_THAN_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_OR_EQUAL_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Shorthand */
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_OLD
|
||||||
|
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, (message))
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_INT
|
||||||
|
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_MEM
|
||||||
|
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((&expected), (&actual), sizeof(expected), __LINE__, message)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_RAW
|
||||||
|
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) == (actual)), __LINE__, message)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message)
|
||||||
|
#endif
|
||||||
|
#ifdef UNITY_SHORTHAND_AS_NONE
|
||||||
|
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* end of UNITY_FRAMEWORK_H */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Vendored
+1326
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user