generated from freudenreichan/info2Praktikum-DobleSpiel
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
782525c6ce |
21
LICENSE.txt
21
LICENSE.txt
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
75
bintree.c
75
bintree.c
@ -1,4 +1,3 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
#include "bintree.h"
|
#include "bintree.h"
|
||||||
@ -13,42 +12,7 @@
|
|||||||
// if isDuplicate is NULL, otherwise ignores duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added).
|
// if isDuplicate is NULL, otherwise ignores duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added).
|
||||||
TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate)
|
TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate)
|
||||||
{
|
{
|
||||||
if (root == NULL) {
|
|
||||||
TreeNode *newNode = (TreeNode *)malloc(sizeof(TreeNode));
|
|
||||||
if (newNode == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
newNode->data = malloc(dataSize);
|
|
||||||
if (newNode->data == NULL) {
|
|
||||||
free(newNode);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
memcpy(newNode->data, data, dataSize);
|
|
||||||
newNode->left = NULL;
|
|
||||||
newNode->right = NULL;
|
|
||||||
|
|
||||||
if (isDuplicate != NULL) {
|
|
||||||
*isDuplicate = 0;
|
|
||||||
}
|
|
||||||
return newNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmp = compareFct(data, root->data);
|
|
||||||
|
|
||||||
if (cmp == 0 && isDuplicate != NULL) {
|
|
||||||
*isDuplicate = 1;
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmp < 0) {
|
|
||||||
root->left = addToTree(root->left, data, dataSize, compareFct, isDuplicate);
|
|
||||||
} else {
|
|
||||||
/* Insert duplicates on the right side if they are allowed (isDuplicate == NULL). */
|
|
||||||
root->right = addToTree(root->right, data, dataSize, compareFct, isDuplicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterates over the tree given by root. Follows the usage of strtok. If tree is NULL, the next entry of the last tree given is returned in ordering direction.
|
// Iterates over the tree given by root. Follows the usage of strtok. If tree is NULL, the next entry of the last tree given is returned in ordering direction.
|
||||||
@ -57,51 +21,16 @@ TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFc
|
|||||||
void *nextTreeData(TreeNode *root)
|
void *nextTreeData(TreeNode *root)
|
||||||
{
|
{
|
||||||
|
|
||||||
static StackNode *iterStack = NULL;
|
|
||||||
|
|
||||||
// Start of traversal
|
|
||||||
if (root != NULL) {
|
|
||||||
clearStack(iterStack);
|
|
||||||
iterStack = NULL;
|
|
||||||
|
|
||||||
for (TreeNode *n = root; n != NULL; n = n->left) {
|
|
||||||
iterStack = push(iterStack, n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stops if no elements left
|
|
||||||
if (iterStack == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pop the top node
|
|
||||||
TreeNode *node = (TreeNode *)top(iterStack);
|
|
||||||
iterStack = pop(iterStack);
|
|
||||||
|
|
||||||
// select node one to the right --> push all lefts
|
|
||||||
for (TreeNode *n = node->right; n != NULL; n = n->left) {
|
|
||||||
iterStack = push(iterStack, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
return node->data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Releases all memory resources (including data copies).
|
// Releases all memory resources (including data copies).
|
||||||
void clearTree(TreeNode *root)
|
void clearTree(TreeNode *root)
|
||||||
{
|
{
|
||||||
if (root != NULL) {
|
|
||||||
clearTree(root->left);
|
|
||||||
clearTree(root->right);
|
|
||||||
free(root->data);
|
|
||||||
free(root);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of entries in the tree given by root.
|
// Returns the number of entries in the tree given by root.
|
||||||
unsigned int treeSize(const TreeNode *root)
|
unsigned int treeSize(const TreeNode *root)
|
||||||
{
|
{
|
||||||
if (root == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1 + treeSize(root->left) + treeSize(root->right);
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1 @@
|
|||||||
patric;9910
|
|
||||||
patric;5988
|
|
||||||
player1;3999
|
player1;3999
|
||||||
test;3994
|
|
||||||
|
|||||||
7
makefile
7
makefile
@ -35,11 +35,8 @@ $(program_obj_filesobj_files): %.o: %.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
# --------------------------
|
# --------------------------
|
||||||
numbers_tests:
|
unitTests:
|
||||||
$(CC) $(FLAGS) numbers.c bintree.c stack.c unity.c test_numbers.c -o test_numbers
|
echo "needs to be implemented"
|
||||||
|
|
||||||
stack_tests:
|
|
||||||
$(CC) $(FLAGS) stack.c unity.c stackunitytest.c -o test_stack
|
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Clean
|
# Clean
|
||||||
|
|||||||
245
numbers.c
245
numbers.c
@ -1,221 +1,26 @@
|
|||||||
/************************************************************
|
#include <stdlib.h>
|
||||||
* BLOCK 0 – Zweck der Datei
|
#include <stdio.h>
|
||||||
* ----------------------------------------------------------
|
#include <time.h>
|
||||||
* Diese Datei liefert zwei Funktionen für das Spiel:
|
#include <string.h>
|
||||||
* - createNumbers(len): erzeugt ein Array mit len Zufallszahlen,
|
#include "numbers.h"
|
||||||
* in dem GENAU EINE Zahl doppelt vorkommt.
|
#include "bintree.h"
|
||||||
* - getDuplicate(numbers, len): findet effizient die doppelte Zahl.
|
|
||||||
*
|
|
||||||
* Technik:
|
|
||||||
* - Beim Erzeugen verhindert ein Binärsuchbaum (BST) Duplikate.
|
|
||||||
* - Beim Finden sortieren wir eine Kopie und vergleichen Nachbarn.
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
#include <stdlib.h> // malloc, free, rand
|
//TODO: getDuplicate und createNumbers implementieren
|
||||||
#include <stdio.h> // optional für Debug/printf
|
/* * * Erzeugen eines Arrays mit der vom Nutzer eingegebenen Anzahl an Zufallszahlen.
|
||||||
#include <time.h> // time() für einmaliges srand-Seed
|
* Sicherstellen, dass beim Befüllen keine Duplikate entstehen.
|
||||||
#include <string.h> // memcpy
|
* Duplizieren eines zufälligen Eintrags im Array.
|
||||||
#include "numbers.h" // Deklarationen: createNumbers, getDuplicate
|
* in `getDuplicate()`: Sortieren des Arrays und Erkennen der doppelten Zahl durch Vergleich benachbarter Elemente. */
|
||||||
#include "bintree.h" // BST-API: addToTree, clearTree, CompareFctType
|
|
||||||
|
// Returns len random numbers between 1 and 2x len in random order which are all different, except for two entries.
|
||||||
|
// Returns NULL on errors. Use your implementation of the binary search tree to check for possible duplicates while
|
||||||
/************************************************************
|
// creating random numbers.
|
||||||
* BLOCK 1 – Gemeinsame Vergleichsfunktion
|
unsigned int *createNumbers(unsigned int len)
|
||||||
* ----------------------------------------------------------
|
{
|
||||||
* compareUInt:
|
|
||||||
* - Definiert die Ordnung für unsigned int (aufsteigend).
|
}
|
||||||
* - Geeignet sowohl für den Binärbaum (addToTree)
|
|
||||||
* als auch für qsort.
|
// Returns only the only number in numbers which is present twice. Returns zero on errors.
|
||||||
* Rückgabewerte:
|
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len)
|
||||||
* - < 0 : a < b → im BST nach LINKS
|
{
|
||||||
* - = 0 : a == b → Duplikat
|
|
||||||
* - > 0 : a > b → im BST nach RECHTS
|
}
|
||||||
************************************************************/
|
|
||||||
static int compareUInt(const void *a, const void *b)
|
|
||||||
{
|
|
||||||
unsigned int va = *(const unsigned int *)a;
|
|
||||||
unsigned int vb = *(const unsigned int *)b;
|
|
||||||
if (va < vb) return -1;
|
|
||||||
if (va > vb) return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
|
||||||
* BLOCK 2 – Zahlen erzeugen: createNumbers(len)
|
|
||||||
* ----------------------------------------------------------
|
|
||||||
* Ziel:
|
|
||||||
* - Ein Array mit len Zufallszahlen im Bereich [1 .. 2*len].
|
|
||||||
* - Zuerst ALLE eindeutig (via BST geprüft).
|
|
||||||
* - Danach GENAU EINE Zahl absichtlich duplizieren.
|
|
||||||
* - Zum Schluss das Array gleichverteilt mischen (Fisher–Yates).
|
|
||||||
*
|
|
||||||
* Rückgabe:
|
|
||||||
* - Pointer auf dynamisch allokiertes Array (Caller muss free).
|
|
||||||
* - NULL bei Fehlern (z. B. len < 2, malloc/Insert-Fehler).
|
|
||||||
************************************************************/
|
|
||||||
unsigned int *createNumbers(unsigned int len)
|
|
||||||
{
|
|
||||||
/***********************
|
|
||||||
* 2.1 Vorbedingungen & Speicher
|
|
||||||
***********************/
|
|
||||||
if (len < 2) // Ein Duplikat macht erst ab 2 Elementen Sinn
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
unsigned int *numbers = (unsigned int *)malloc(sizeof(unsigned int) * len);
|
|
||||||
if (!numbers) // Speicherfehler
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 2.2 Einmaliges Zufalls-Seed
|
|
||||||
* (falls main() nicht seedet, sorgen wir einmalig dafür)
|
|
||||||
***********************/
|
|
||||||
static int seeded = 0; // Merker: srand nur einmal pro Prozess
|
|
||||||
if (!seeded) {
|
|
||||||
srand((unsigned int)time(NULL));
|
|
||||||
seeded = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 2.3 BST-Setup & Wertebereich
|
|
||||||
***********************/
|
|
||||||
TreeNode *root = NULL; // Leerer Binärbaum zum Duplikat-Check
|
|
||||||
unsigned int range = 2 * len; // Zahlenbereich: 1..2*len
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 2.4 len-1 EINDEUTIGE Zahlen erzeugen
|
|
||||||
* – jede Zahl sofort gegen den BST prüfen
|
|
||||||
***********************/
|
|
||||||
for (unsigned int i = 0; i < len - 1; i++)
|
|
||||||
{
|
|
||||||
unsigned int val;
|
|
||||||
int isDup;
|
|
||||||
|
|
||||||
// Wiederholen, bis eine wirklich neue Zahl eingefügt wurde
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
isDup = 0; // vor jedem Insert zurücksetzen
|
|
||||||
val = (unsigned int)(rand() % range) + 1; // Kandidat in [1..2*len]
|
|
||||||
|
|
||||||
// Versuch, val in den Baum einzufügen (Kopie wird im Knoten gespeichert)
|
|
||||||
TreeNode *newRoot = addToTree(root, &val, sizeof(val), compareUInt, &isDup);
|
|
||||||
|
|
||||||
// Fehlerfall: Es wäre ein neuer Knoten, aber newRoot ist NULL (z. B. malloc-Fehler)
|
|
||||||
if (newRoot == NULL && isDup == 0) {
|
|
||||||
free(numbers); // Array freigeben
|
|
||||||
clearTree(root); // bisherige Baumknoten freigeben
|
|
||||||
return NULL; // sauber abbrechen
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wurzel ggf. aktualisieren (z. B. wenn Baum vorher leer war)
|
|
||||||
if (newRoot) {
|
|
||||||
root = newRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isDup) {
|
|
||||||
// Wert war eindeutig → ins Array übernehmen und weiter zum nächsten i
|
|
||||||
numbers[i] = val;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// sonst: Duplikat → neue Zufallszahl probieren
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 2.5 GENAU EIN Duplikat erzeugen
|
|
||||||
* – eine der bestehenden Zahlen zufällig wählen und erneut eintragen
|
|
||||||
***********************/
|
|
||||||
unsigned int idx = (unsigned int)(rand() % (len - 1)); // Quelle in [0..len-2]
|
|
||||||
numbers[len - 1] = numbers[idx]; // Duplikat absichtlich erzeugt
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 2.6 Gleichverteiltes Mischen (Fisher–Yates)
|
|
||||||
***********************/
|
|
||||||
for (unsigned int i = len - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
unsigned int j = (unsigned int)(rand() % (i + 1)); // j ∈ [0..i]
|
|
||||||
unsigned int tmp = numbers[i];
|
|
||||||
numbers[i] = numbers[j];
|
|
||||||
numbers[j] = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 2.7 Aufräumen & Rückgabe
|
|
||||||
***********************/
|
|
||||||
clearTree(root); // BST wird nicht mehr gebraucht
|
|
||||||
return numbers; // Ownership des Arrays liegt beim Aufrufer (free(numbers))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
|
||||||
* BLOCK 3 – Duplikat finden: getDuplicate(numbers, len)
|
|
||||||
* ----------------------------------------------------------
|
|
||||||
* Idee:
|
|
||||||
* - Original-Array unangetastet lassen → KOPIE erstellen.
|
|
||||||
* - Kopie aufsteigend sortieren (qsort mit demselben Comparator).
|
|
||||||
* - Ein linearer Durchlauf findet das erste Paar identischer Nachbarn.
|
|
||||||
*
|
|
||||||
* Rückgabe:
|
|
||||||
* - die doppelte Zahl
|
|
||||||
* - 0 bei Fehlern (z. B. ungültige Parameter, malloc-Fehler).
|
|
||||||
************************************************************/
|
|
||||||
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len)
|
|
||||||
{
|
|
||||||
/***********************
|
|
||||||
* 3.1 Vorbedingungen & Kopie allokieren
|
|
||||||
***********************/
|
|
||||||
if (!numbers || len < 2) // ungültig oder zu kurz
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unsigned int *copy = (unsigned int *)malloc(sizeof(unsigned int) * len);
|
|
||||||
if (!copy) // Speicherfehler
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memcpy(copy, numbers, sizeof(unsigned int) * len); // Original in Kopie übertragen
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 3.2 Kopie sortieren (qsort + compareUInt)
|
|
||||||
***********************/
|
|
||||||
qsort(copy, len, sizeof(unsigned int), compareUInt);
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 3.3 Nachbarvergleich: erstes Paar gleicher Werte = Duplikat
|
|
||||||
***********************/
|
|
||||||
unsigned int result = 0;
|
|
||||||
for (unsigned int i = 0; i + 1 < len; i++)
|
|
||||||
{
|
|
||||||
if (copy[i] == copy[i + 1]) {
|
|
||||||
result = copy[i];
|
|
||||||
break; // Duplikat gefunden → fertig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************
|
|
||||||
* 3.4 Aufräumen & Rückgabe
|
|
||||||
***********************/
|
|
||||||
free(copy); // Kopie freigeben
|
|
||||||
return result; // 0, falls (unerwartet) kein Duplikat gefunden
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
|
||||||
* BLOCK 4 – Hinweise für die Vorstellung
|
|
||||||
* ----------------------------------------------------------
|
|
||||||
* Ownership:
|
|
||||||
* - Das von createNumbers zurückgegebene Array muss vom Aufrufer
|
|
||||||
* später mit free(numbers) freigegeben werden.
|
|
||||||
*
|
|
||||||
* Fehlerbehandlung:
|
|
||||||
* - Bei jedem Fehlerpfad werden ALLLE angelegten Ressourcen sauber
|
|
||||||
* freigegeben (Array/Kopie/Baum).
|
|
||||||
*
|
|
||||||
* Komplexität:
|
|
||||||
* - Erzeugen: O(n log n) durch BST-Einfügen + O(n) fürs Shuffle.
|
|
||||||
* - Finden: O(n log n) durch qsort + O(n) für den Nachbarvergleich.
|
|
||||||
*
|
|
||||||
* Zusammenarbeit:
|
|
||||||
* - addToTree setzt bei Gleichheit isDuplicate=1 (Duplikat),
|
|
||||||
* und liefert bei neuen Werten die (ggf. neue) Wurzel zurück.
|
|
||||||
* - clearTree gibt ALLE Knoten inkl. Datenkopien frei.
|
|
||||||
************************************************************/
|
|
||||||
|
|
||||||
199
numbers_test2.c
Normal file
199
numbers_test2.c
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "numbers.h"
|
||||||
|
#include "bintree.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Vergleichsfunktion für unsigned int-Werte zur Verwendung im Binärbaum.
|
||||||
|
*
|
||||||
|
* Diese Funktion wird von der Binärbaum-Implementierung genutzt, um die
|
||||||
|
* Ordnung der Knoten zu bestimmen. Sie vergleicht die dereferenzierten
|
||||||
|
* unsigned int-Werte a und b.
|
||||||
|
*
|
||||||
|
* @param a Pointer auf einen unsigned int-Wert (linker Operand)
|
||||||
|
* @param b Pointer auf einen unsigned int-Wert (rechter Operand)
|
||||||
|
* @return -1, falls *a < *b; 1, falls *a > *b; 0, falls *a == *b
|
||||||
|
*/
|
||||||
|
static int compareUInt(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
unsigned int va = *(const unsigned int *)a;
|
||||||
|
unsigned int vb = *(const unsigned int *)b;
|
||||||
|
if (va < vb) return -1;
|
||||||
|
if (va > vb) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Vergleichsfunktion für qsort() zur Sortierung von unsigned int-Arrays.
|
||||||
|
*
|
||||||
|
* @param a Pointer auf einen Arrayeintrag
|
||||||
|
* @param b Pointer auf einen Arrayeintrag
|
||||||
|
* @return -1, 0, 1 analog zu compareUInt()
|
||||||
|
*/
|
||||||
|
static int qsort_uint_cmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
unsigned int va = *(const unsigned int *)a;
|
||||||
|
unsigned int vb = *(const unsigned int *)b;
|
||||||
|
if (va < vb) return -1;
|
||||||
|
if (va > vb) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Erzeugt ein Array aus len Zufallszahlen im Bereich [1 .. 2*len],
|
||||||
|
* das genau einen duplizierten Wert enthält (d. h. len-1 eindeutige + 1 Duplikat),
|
||||||
|
* und mischt die Reihenfolge zufällig.
|
||||||
|
*
|
||||||
|
* Funktionsweise:
|
||||||
|
* - Es werden zunächst len-1 eindeutige Zufallszahlen erzeugt. Die Eindeutigkeit wird
|
||||||
|
* mithilfe eines Binärsuchbaums (BST) geprüft: addToTree() fügt die Zahl ein
|
||||||
|
* und signalisiert per isDup, ob sie bereits vorhanden war.
|
||||||
|
* - Anschließend wird eine der bereits erzeugten Zahlen zufällig ausgewählt und
|
||||||
|
* noch einmal an das Ende des Arrays geschrieben, um das geforderte Duplikat sicherzustellen.
|
||||||
|
* - Zum Schluss wird das gesamte Array mittels Fisher–Yates-Algorithmus gemischt.
|
||||||
|
*
|
||||||
|
* Fehlerbehandlung:
|
||||||
|
* - Bei len < 2 wird NULL zurückgegeben, da das Problem ein Duplikat erfordert.
|
||||||
|
* - Bei Speicher- oder Baum-Insertionsfehlern wird aufgeräumt und NULL zurückgegeben.
|
||||||
|
* Wichtig: Der Baumzeiger root wird erst nach erfolgreichem Insert aktualisiert,
|
||||||
|
* um im Fehlerfall kein bereits aufgebautes Teilbaum-Objekt zu verlieren.
|
||||||
|
*
|
||||||
|
* Randbedingungen / Annahmen:
|
||||||
|
* - addToTree(root, &val, sizeof(val), compareUInt, &isDup) setzt isDup:
|
||||||
|
* isDup == 1 bedeutet „Duplikat gefunden, Baum unverändert“,
|
||||||
|
* isDup == 0 bedeutet „neuer Wert eingefügt (oder Fehler)“.
|
||||||
|
* - Bei Speicherfehler gibt addToTree NULL zurück und isDup bleibt 0.
|
||||||
|
* - clearTree(root) darf mit NULL-Argument aufgerufen werden (No-Op).
|
||||||
|
*
|
||||||
|
* Komplexität:
|
||||||
|
* - Durchschnittlich O(len * log(len)) für die len-1 Einfügungen in den BST.
|
||||||
|
* - Shuffle in O(len).
|
||||||
|
*
|
||||||
|
* @param len Anzahl der zu erzeugenden Werte (muss >= 2 sein)
|
||||||
|
* @return Pointer auf ein Array mit len Einträgen bei Erfolg; NULL bei Fehlern
|
||||||
|
*/
|
||||||
|
unsigned int *createNumbers(unsigned int len)
|
||||||
|
{
|
||||||
|
if (len < 2)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
unsigned int *numbers = (unsigned int *)malloc(sizeof(unsigned int) * len);
|
||||||
|
if (numbers == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// Zufallszahlengenerator nur einmal pro Prozess initialisieren.
|
||||||
|
// Hintergrund: Wird createNumbers mehrfach schnell hintereinander gerufen,
|
||||||
|
// kann time(NULL) identische Seeds liefern und damit identische Zahlenfolgen erzeugen.
|
||||||
|
static int seeded = 0;
|
||||||
|
if (!seeded) {
|
||||||
|
srand((unsigned int)time(NULL));
|
||||||
|
seeded = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeNode *root = NULL;
|
||||||
|
unsigned int range = 2 * len;
|
||||||
|
|
||||||
|
// Schritt 1: len-1 eindeutige Zufallszahlen erzeugen
|
||||||
|
for (unsigned int i = 0; i < len - 1; i++)
|
||||||
|
{
|
||||||
|
unsigned int val;
|
||||||
|
int isDup;
|
||||||
|
|
||||||
|
// Wiederholen, bis eine wirklich neue Zahl eingefügt wurde
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
isDup = 0; // vor jedem Insert zurücksetzen, um „alte“ Werte zu vermeiden
|
||||||
|
val = (unsigned int)(rand() % range) + 1; // Wertebereich [1 .. 2*len]
|
||||||
|
|
||||||
|
// addToTree kann bei Erfolg einen (ggf. neuen) Wurzelzeiger liefern.
|
||||||
|
// Zur Vermeidung eines Speicherlecks bei Fehlern zunächst in temp speichern.
|
||||||
|
TreeNode *newRoot = addToTree(root, &val, sizeof(val), compareUInt, &isDup);
|
||||||
|
|
||||||
|
if (newRoot == NULL && isDup == 0) {
|
||||||
|
// Vermutlich Speicher-/Insertionsfehler: aufräumen und abbrechen
|
||||||
|
free(numbers);
|
||||||
|
clearTree(root); // root zeigt noch auf den gültigen Teilbaum
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isDup) {
|
||||||
|
// Einfügen war erfolgreich und der Wert ist eindeutig.
|
||||||
|
root = newRoot;
|
||||||
|
numbers[i] = val;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Andernfalls Duplikat: Neue Zufallszahl versuchen.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schritt 2: Eine der bestehenden Zahlen zufällig duplizieren
|
||||||
|
unsigned int idx = (unsigned int)(rand() % (len - 1)); // Index im Bereich [0 .. len-2]
|
||||||
|
numbers[len - 1] = numbers[idx];
|
||||||
|
|
||||||
|
// Schritt 3: Fisher–Yates-Shuffle über das gesamte Array
|
||||||
|
for (unsigned int i = len - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
unsigned int j = (unsigned int)(rand() % (i + 1));
|
||||||
|
unsigned int tmp = numbers[i];
|
||||||
|
numbers[i] = numbers[j];
|
||||||
|
numbers[j] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aufräumen: Baum freigeben
|
||||||
|
clearTree(root);
|
||||||
|
return numbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Findet den einzigen duplizierten Wert in einem Array aus len unsigned int.
|
||||||
|
*
|
||||||
|
* Funktionsweise:
|
||||||
|
* - Es wird eine Kopie des Eingabearrays erstellt, um die Reihenfolge des
|
||||||
|
* Originalarrays nicht zu verändern.
|
||||||
|
* - Die Kopie wird mittels qsort() aufsteigend sortiert.
|
||||||
|
* - Beim Durchlauf werden benachbarte Elemente verglichen. Da genau ein Wert
|
||||||
|
* doppelt vorkommt, finden wir ihn als erstes Paar gleicher Nachbarn.
|
||||||
|
*
|
||||||
|
* Fehlerbehandlung:
|
||||||
|
* - Bei ungültigen Parametern (numbers == NULL oder len < 2) wird 0 geliefert.
|
||||||
|
* - Bei Speicherfehlern beim Kopieren ebenfalls 0.
|
||||||
|
*
|
||||||
|
* Komplexität:
|
||||||
|
* - Sortieren in O(len * log(len)), anschließender Linearpass O(len).
|
||||||
|
*
|
||||||
|
* @param numbers Pointer auf das Eingabearray
|
||||||
|
* @param len Länge des Arrays (muss >= 2 sein)
|
||||||
|
* @return Der doppelte Wert; 0 bei Fehlern oder falls kein Duplikat gefunden wurde
|
||||||
|
* (gemäß Aufgabenstellung sollte aber genau ein Duplikat existieren).
|
||||||
|
*/
|
||||||
|
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len)
|
||||||
|
{
|
||||||
|
if (numbers == NULL || len < 2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Kopie erstellen, damit das Original unangetastet bleibt
|
||||||
|
unsigned int *copy = (unsigned int *)malloc(sizeof(unsigned int) * len);
|
||||||
|
if (copy == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memcpy(copy, numbers, sizeof(unsigned int) * len);
|
||||||
|
|
||||||
|
// Sortieren der Kopie
|
||||||
|
qsort(copy, len, sizeof(unsigned int), qsort_uint_cmp);
|
||||||
|
|
||||||
|
// Linearer Scan: erstes Paar identischer Nachbarn ist das Duplikat
|
||||||
|
unsigned int result = 0;
|
||||||
|
for (unsigned int i = 0; i + 1 < len; i++)
|
||||||
|
{
|
||||||
|
if (copy[i] == copy[i + 1]) {
|
||||||
|
result = copy[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(copy);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
49
stack.c
49
stack.c
@ -6,69 +6,28 @@
|
|||||||
* `pop`: entfernt das oberste Element,
|
* `pop`: entfernt das oberste Element,
|
||||||
* `top`: liefert das oberste Element zurück,
|
* `top`: liefert das oberste Element zurück,
|
||||||
* `clearStack`: gibt den gesamten Speicher frei. */
|
* `clearStack`: gibt den gesamten Speicher frei. */
|
||||||
|
|
||||||
|
|
||||||
// Pushes data as pointer onto the stack.
|
// Pushes data as pointer onto the stack.
|
||||||
// *stack zeiger auf das ganze konstrukt
|
|
||||||
// *data soll oben drauf gepusht werden; daten die davor drin waren werden runtergeschoben
|
|
||||||
// stack wird zurückgegeben
|
|
||||||
StackNode *push(StackNode *stack, void *data)
|
StackNode *push(StackNode *stack, void *data)
|
||||||
{
|
{
|
||||||
if(data != NULL)
|
|
||||||
{
|
|
||||||
StackNode *top;
|
|
||||||
top = malloc(sizeof(*top));
|
|
||||||
if(top == NULL)
|
|
||||||
{
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
top->data = data;
|
|
||||||
if(stack == NULL)
|
|
||||||
{
|
|
||||||
top->next = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
top->next = stack;
|
|
||||||
}
|
|
||||||
stack = top;
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deletes the top element of the stack (latest added element) and releases its memory. (Pointer to data has to be
|
// Deletes the top element of the stack (latest added element) and releases its memory. (Pointer to data has to be
|
||||||
// freed by caller.)
|
// freed by caller.)
|
||||||
// data wird entfernt-> next wird der neue stack
|
|
||||||
StackNode *pop(StackNode *stack)
|
StackNode *pop(StackNode *stack)
|
||||||
{
|
{
|
||||||
if(stack != NULL)
|
|
||||||
{
|
|
||||||
StackNode *nextNode = stack->next; //zeiger der auf next zeigt da der Kopf entfernt wird
|
|
||||||
free(stack);
|
|
||||||
stack = nextNode; //next wird der neue stack
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the data of the top element.
|
// Returns the data of the top element.
|
||||||
// gibt das oberste Element aus (data)
|
|
||||||
void *top(StackNode *stack)
|
void *top(StackNode *stack)
|
||||||
{
|
{
|
||||||
if(stack == 0)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return stack->data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clears stack and releases all memory.
|
// Clears stack and releases all memory.
|
||||||
void clearStack(StackNode *stack)
|
void clearStack(StackNode *stack)
|
||||||
{
|
{
|
||||||
while(stack != NULL)
|
|
||||||
{
|
|
||||||
stack = pop(stack);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
4
stack.h
4
stack.h
@ -8,10 +8,6 @@ The latest element is taken from the stack. */
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
//TODO: passenden Datentyp als struct anlegen
|
//TODO: passenden Datentyp als struct anlegen
|
||||||
typedef struct Stack{
|
|
||||||
void *data; //zeiger auf variable
|
|
||||||
struct Stack *next; // zeiger auf ein weiteres stack (data und next)
|
|
||||||
} StackNode;
|
|
||||||
|
|
||||||
// Pushes data as pointer onto the stack.
|
// Pushes data as pointer onto the stack.
|
||||||
StackNode *push(StackNode *stack, void *data);
|
StackNode *push(StackNode *stack, void *data);
|
||||||
|
|||||||
208
stackunitytest.c
208
stackunitytest.c
@ -1,208 +0,0 @@
|
|||||||
#include "unity.h"
|
|
||||||
#include "stack.h"
|
|
||||||
|
|
||||||
|
|
||||||
void setUp(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
void tearDown(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
// 1. Test: push wenn data NULL ist -> stack bleibt NULL
|
|
||||||
void test_push_data_NULL(void)
|
|
||||||
{
|
|
||||||
int test = 30;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
//data = NULL -> stack bleibt NULL
|
|
||||||
TEST_ASSERT_NULL(push(NULL,NULL));
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Test: push data ungleich NULL -> data wird erneuert und next bleibt NULL
|
|
||||||
void test_push_erster_push(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
StackNode expected = {&test, NULL};
|
|
||||||
stack = push(stack, &test);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test, stack->data);
|
|
||||||
TEST_ASSERT_EQUAL_MEMORY(&expected, stack, sizeof(StackNode));
|
|
||||||
TEST_ASSERT_NULL(stack->next);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
//3. Test: zweimal pushen -> data wird zur zweiten Variable; next wird zur ersten
|
|
||||||
void test_push_zweiter_push(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
int test2 = 40;
|
|
||||||
stack = push(stack, &test2);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test2, stack->data);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack->next);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test, stack->next->data);
|
|
||||||
TEST_ASSERT_NULL(stack->next->next);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. Test: dreimal pushen -> data wird zur dritten variable; next zur zweiten; zweiter next zur dritten
|
|
||||||
void test_push_dritter_push(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
int test2 = 40;
|
|
||||||
stack = push(stack, &test2);
|
|
||||||
int test3 = 60;
|
|
||||||
stack = push(stack, &test3);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test3, stack->data);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack->next);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test2, stack->next->data);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack->next->next);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test, stack->next->next->data);
|
|
||||||
TEST_ASSERT_NULL(stack->next->next->next);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 5. Test: pop wenn Stack gleich NULL -> Stack bleibt NULL
|
|
||||||
void test_pop_stack_gleich_NULL(void)
|
|
||||||
{
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = pop(stack);
|
|
||||||
TEST_ASSERT_NULL(stack);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 6. Test: pop mit einer Node -> Stack wird wieder NULL
|
|
||||||
void test_pop_Stack_ungleich_NULL_eine_Node(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
stack = pop(stack);
|
|
||||||
TEST_ASSERT_NULL(stack);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 7. Test: pop mit zwei Nodes -> data wird zur ersten Variable; next wird Null
|
|
||||||
void test_pop_Stack_ungleich_NULL_zwei_Nodes(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
int test2 = 40;
|
|
||||||
stack = push(stack, &test2);
|
|
||||||
stack = pop(stack);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test, stack->data);
|
|
||||||
TEST_ASSERT_NULL(stack->next);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 8. Test: pop mikt drei Nodes -> data wird zur zweiten Variable; next zur ersten; next von next wird NULL
|
|
||||||
void test_pop_Stack_ungleich_NULL_drei_Nodes(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
int test2 = 40;
|
|
||||||
stack = push(stack, &test2);
|
|
||||||
int test3 = 60;
|
|
||||||
stack = push(stack, &test3);
|
|
||||||
stack = pop(stack);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test2, stack->data);
|
|
||||||
TEST_ASSERT_NOT_NULL(stack->next);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test, stack->next->data);
|
|
||||||
TEST_ASSERT_NULL(stack->next->next);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 9. Test: top wenn stack gleich NULL -> gibt null zurück
|
|
||||||
void test_top_stack_gleich_NULL(void)
|
|
||||||
{
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
TEST_ASSERT_NULL(stack);
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 10. Test: top wenn eine Node -> gibt erste Variable aus
|
|
||||||
void test_top_stack_ungleich_NULL_eine_Node(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test, top(stack));
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 11. Test: top bei zwei Nodes -> gibt zweite Variable aus
|
|
||||||
void test_top_stack_ungleich_NULL_zwei_Node(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
int test2 = 40;
|
|
||||||
stack = push(stack, &test2);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test2, top(stack));
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 12. Test: top bei drei Nodes -> gibt dritte Variable
|
|
||||||
void test_top_stack_ungleich_NULL_drei_Node(void)
|
|
||||||
{
|
|
||||||
int test = 20;
|
|
||||||
StackNode *stack = NULL;
|
|
||||||
stack = push(stack, &test);
|
|
||||||
int test2 = 40;
|
|
||||||
stack = push(stack, &test2);
|
|
||||||
int test3 = 60;
|
|
||||||
stack = push(stack, &test3);
|
|
||||||
TEST_ASSERT_EQUAL_PTR(&test3, top(stack));
|
|
||||||
clearStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
UNITY_BEGIN();
|
|
||||||
RUN_TEST(test_push_data_NULL);
|
|
||||||
RUN_TEST(test_push_erster_push);
|
|
||||||
RUN_TEST(test_push_zweiter_push);
|
|
||||||
RUN_TEST(test_push_dritter_push);
|
|
||||||
RUN_TEST(test_pop_stack_gleich_NULL);
|
|
||||||
RUN_TEST(test_pop_Stack_ungleich_NULL_eine_Node);
|
|
||||||
RUN_TEST(test_pop_Stack_ungleich_NULL_zwei_Nodes);
|
|
||||||
RUN_TEST(test_pop_Stack_ungleich_NULL_drei_Nodes);
|
|
||||||
RUN_TEST(test_top_stack_gleich_NULL);
|
|
||||||
RUN_TEST(test_top_stack_ungleich_NULL_eine_Node);
|
|
||||||
RUN_TEST(test_top_stack_ungleich_NULL_zwei_Node);
|
|
||||||
RUN_TEST(test_top_stack_ungleich_NULL_drei_Node);
|
|
||||||
|
|
||||||
return UNITY_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*TEST_ASSERT_NULL(ptr) ptr == NULL
|
|
||||||
TEST_ASSERT_NOT_NULL(ptr) ptr != NULL
|
|
||||||
TEST_ASSERT_EQUAL_PTR(expected, actual) gleiche Adresse
|
|
||||||
TEST_ASSERT_EQUAL_MEMORY(exp, act, size) gleicher Speicherinhalt
|
|
||||||
TEST_ASSERT_EQUAL_INT_ARRAY(a, b, len) prüft Array-Speicher als ints
|
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(a, b, len) prüft Byte-Array*/
|
|
||||||
159
test_numbers.c
159
test_numbers.c
@ -1,159 +0,0 @@
|
|||||||
|
|
||||||
// test_numbers_unity.c
|
|
||||||
#include "unity.h"
|
|
||||||
#include "numbers.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
void setUp(void) { /* nothing */ }
|
|
||||||
void tearDown(void){ /* nothing */ }
|
|
||||||
|
|
||||||
// Zählt Vorkommen eines Werts im Array
|
|
||||||
static unsigned count_occurrences(const unsigned int *arr, unsigned int len, unsigned int value)
|
|
||||||
{
|
|
||||||
unsigned cnt = 0;
|
|
||||||
for (unsigned i = 0; i < len; ++i)
|
|
||||||
if (arr[i] == value) ++cnt;
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prüft Eigenschaften von createNumbers:
|
|
||||||
- Wertebereich: [1..2*len]
|
|
||||||
- Genau EIN Wert doppelt (keiner > 2x)
|
|
||||||
Liefert den doppelten Wert per Out-Param zurück.
|
|
||||||
*/
|
|
||||||
static void assert_numbers_properties(const unsigned int *arr, unsigned int len, unsigned int *dup_out)
|
|
||||||
{
|
|
||||||
TEST_ASSERT_NOT_NULL(arr);
|
|
||||||
TEST_ASSERT_TRUE(len >= 2);
|
|
||||||
|
|
||||||
const unsigned int maxVal = 2 * len;
|
|
||||||
|
|
||||||
// Häufigkeitstabelle von 0..maxVal (0 bleibt ungenutzt)
|
|
||||||
unsigned int *counts = (unsigned int*)calloc(maxVal + 1, sizeof(unsigned int));
|
|
||||||
TEST_ASSERT_NOT_NULL_MESSAGE(counts, "calloc(counts) failed");
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < len; ++i)
|
|
||||||
{
|
|
||||||
unsigned int v = arr[i];
|
|
||||||
TEST_ASSERT_TRUE_MESSAGE(v >= 1 && v <= maxVal, "value out of [1..2*len]");
|
|
||||||
counts[v]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dupCount = 0;
|
|
||||||
unsigned int dupVal = 0;
|
|
||||||
for (unsigned int v = 1; v <= maxVal; ++v)
|
|
||||||
{
|
|
||||||
if (counts[v] == 2) { dupCount++; dupVal = v; }
|
|
||||||
TEST_ASSERT_LESS_OR_EQUAL_UINT_MESSAGE(2u, counts[v], "a value occurs more than twice");
|
|
||||||
}
|
|
||||||
|
|
||||||
free(counts);
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(1, dupCount, "not exactly one duplicated value");
|
|
||||||
if (dup_out) *dup_out = dupVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Einzeltests
|
|
||||||
|
|
||||||
// createNumbers: len < 2 -> NULL
|
|
||||||
static void test_createNumbers_len_too_small(void)
|
|
||||||
{
|
|
||||||
TEST_ASSERT_NULL(createNumbers(0));
|
|
||||||
TEST_ASSERT_NULL(createNumbers(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// createNumbers: Eigenschaften bei repräsentativer Länge
|
|
||||||
static void test_createNumbers_properties_len20(void)
|
|
||||||
{
|
|
||||||
const unsigned int len = 20;
|
|
||||||
unsigned int *arr = createNumbers(len);
|
|
||||||
TEST_ASSERT_NOT_NULL(arr);
|
|
||||||
|
|
||||||
unsigned int dupVal = 0;
|
|
||||||
assert_numbers_properties(arr, len, &dupVal);
|
|
||||||
|
|
||||||
// Der gefundene doppelte Wert muss auch wirklich genau 2x im Array stehen
|
|
||||||
TEST_ASSERT_EQUAL_UINT(2u, count_occurrences(arr, len, dupVal));
|
|
||||||
|
|
||||||
free(arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// getDuplicate: Minimalfall [x, x] -> x
|
|
||||||
static void test_getDuplicate_minimal_pair(void)
|
|
||||||
{
|
|
||||||
unsigned int a[2] = { 5, 5 };
|
|
||||||
TEST_ASSERT_EQUAL_UINT(5u, getDuplicate(a, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
// getDuplicate: Bekannte, unsortierte Arrays
|
|
||||||
static void test_getDuplicate_known_arrays(void)
|
|
||||||
{
|
|
||||||
unsigned int a1[] = {1,2,3,4,5,3}; // dup = 3
|
|
||||||
unsigned int a2[] = {7,1,3,4,7}; // dup = 7
|
|
||||||
unsigned int a3[] = {9,8,9,1,2,3,4}; // dup = 9
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT(3u, getDuplicate(a1, (unsigned) (sizeof a1/sizeof a1[0])));
|
|
||||||
TEST_ASSERT_EQUAL_UINT(7u, getDuplicate(a2, (unsigned) (sizeof a2/sizeof a2[0])));
|
|
||||||
TEST_ASSERT_EQUAL_UINT(9u, getDuplicate(a3, (unsigned) (sizeof a3/sizeof a3[0])));
|
|
||||||
}
|
|
||||||
|
|
||||||
// getDuplicate: Ungültige Eingaben -> 0
|
|
||||||
static void test_getDuplicate_invalid_inputs(void)
|
|
||||||
{
|
|
||||||
TEST_ASSERT_EQUAL_UINT(0u, getDuplicate(NULL, 10));
|
|
||||||
unsigned int x = 42;
|
|
||||||
TEST_ASSERT_EQUAL_UINT(0u, getDuplicate(&x, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Integration: createNumbers + getDuplicate (mehrere Läufe)
|
|
||||||
static void test_integration_create_then_getDuplicate_multi_runs(void)
|
|
||||||
{
|
|
||||||
const unsigned int len = 30;
|
|
||||||
for (int run = 0; run < 3; ++run)
|
|
||||||
{
|
|
||||||
unsigned int *arr = createNumbers(len);
|
|
||||||
TEST_ASSERT_NOT_NULL(arr);
|
|
||||||
|
|
||||||
// Eigenschaften prüfen
|
|
||||||
unsigned int dupVal = 0;
|
|
||||||
assert_numbers_properties(arr, len, &dupVal);
|
|
||||||
|
|
||||||
// getDuplicate muss genau diesen Wert liefern
|
|
||||||
TEST_ASSERT_EQUAL_UINT(dupVal, getDuplicate(arr, len));
|
|
||||||
|
|
||||||
free(arr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// getDuplicate verändert das Original-Array NICHT
|
|
||||||
static void test_getDuplicate_does_not_modify_input(void)
|
|
||||||
{
|
|
||||||
unsigned int arr[] = { 10, 2, 10, 7, 8, 9, 1 };
|
|
||||||
unsigned int original[sizeof arr/sizeof arr[0]];
|
|
||||||
memcpy(original, arr, sizeof arr);
|
|
||||||
|
|
||||||
unsigned int dup = getDuplicate(arr, (unsigned) (sizeof arr/sizeof arr[0]));
|
|
||||||
TEST_ASSERT_EQUAL_UINT(10u, dup);
|
|
||||||
|
|
||||||
// Speicherinhalt identisch?
|
|
||||||
TEST_ASSERT_EQUAL_MEMORY(original, arr, sizeof arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Runner
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
UNITY_BEGIN();
|
|
||||||
|
|
||||||
RUN_TEST(test_createNumbers_len_too_small);
|
|
||||||
RUN_TEST(test_createNumbers_properties_len20);
|
|
||||||
RUN_TEST(test_getDuplicate_minimal_pair);
|
|
||||||
RUN_TEST(test_getDuplicate_known_arrays);
|
|
||||||
RUN_TEST(test_getDuplicate_invalid_inputs);
|
|
||||||
RUN_TEST(test_integration_create_then_getDuplicate_multi_runs);
|
|
||||||
RUN_TEST(test_getDuplicate_does_not_modify_input);
|
|
||||||
|
|
||||||
return UNITY_END();
|
|
||||||
}
|
|
||||||
BIN
test_numbers.exe
BIN
test_numbers.exe
Binary file not shown.
BIN
test_stack.exe
BIN
test_stack.exe
Binary file not shown.
698
unity.h
698
unity.h
@ -1,698 +0,0 @@
|
|||||||
/* =========================================================================
|
|
||||||
Unity - A Test Framework for C
|
|
||||||
ThrowTheSwitch.org
|
|
||||||
Copyright (c) 2007-25 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 6
|
|
||||||
#define UNITY_VERSION_BUILD 2
|
|
||||||
#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)
|
|
||||||
|
|
||||||
/* 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))
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
1271
unity_internals.h
1271
unity_internals.h
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user