mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-26 01:41:35 +01:00
Merge branch 'master' into float-printing
This commit is contained in:
139
src/unity.c
139
src/unity.c
@@ -14,8 +14,8 @@ void UNITY_OUTPUT_CHAR(int);
|
||||
#endif
|
||||
|
||||
/* Helpful macros for us to use here in Assert functions */
|
||||
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; TEST_ABORT(); }
|
||||
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; TEST_ABORT(); }
|
||||
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
|
||||
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
|
||||
#define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) return
|
||||
|
||||
struct UNITY_STORAGE_T Unity;
|
||||
@@ -67,6 +67,7 @@ static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
|
||||
* Pretty Printers & Test Result Output Handlers
|
||||
*-----------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityPrint(const char* string)
|
||||
{
|
||||
const char* pch = string;
|
||||
@@ -116,6 +117,7 @@ void UnityPrint(const char* string)
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityPrintLen(const char* string, const UNITY_UINT32 length)
|
||||
{
|
||||
const char* pch = string;
|
||||
@@ -212,7 +214,9 @@ void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
|
||||
int nibble;
|
||||
char nibbles = nibbles_to_print;
|
||||
if ((unsigned)nibbles > (2 * sizeof(number)))
|
||||
{
|
||||
nibbles = 2 * sizeof(number);
|
||||
}
|
||||
|
||||
while (nibbles > 0)
|
||||
{
|
||||
@@ -287,15 +291,24 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
|
||||
}
|
||||
|
||||
/* handle zero, NaN, and +/- infinity */
|
||||
if (number == 0.0f) UnityPrint("0");
|
||||
else if (isnan(number)) UnityPrint("nan");
|
||||
else if (isinf(number)) UnityPrint("inf");
|
||||
if (number == 0.0f)
|
||||
{
|
||||
UnityPrint("0");
|
||||
}
|
||||
else if (isnan(number))
|
||||
{
|
||||
UnityPrint("nan");
|
||||
}
|
||||
else if (isinf(number))
|
||||
{
|
||||
UnityPrint("inf");
|
||||
}
|
||||
else
|
||||
{
|
||||
UNITY_INT32 n_int = 0, n;
|
||||
int exponent = 0;
|
||||
int decimals, digits;
|
||||
char buf[16];
|
||||
char buf[16] = {0};
|
||||
|
||||
/*
|
||||
* Scale up or down by powers of 10. To minimize rounding error,
|
||||
@@ -447,6 +460,7 @@ void UnityConcludeTest(void)
|
||||
|
||||
Unity.CurrentTestFailed = 0;
|
||||
Unity.CurrentTestIgnored = 0;
|
||||
UNITY_EXEC_TIME_RESET();
|
||||
UNITY_PRINT_EOL();
|
||||
UNITY_FLUSH_CALL();
|
||||
}
|
||||
@@ -534,6 +548,7 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected,
|
||||
* Assertion & Control Helpers
|
||||
*-----------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
|
||||
UNITY_INTERNAL_PTR actual,
|
||||
const UNITY_LINE_TYPE lineNumber,
|
||||
@@ -566,6 +581,7 @@ static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
|
||||
* Assertion Functions
|
||||
*-----------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertBits(const UNITY_INT mask,
|
||||
const UNITY_INT expected,
|
||||
const UNITY_INT actual,
|
||||
@@ -672,11 +688,17 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
||||
UnityPrintPointlessAndBail();
|
||||
}
|
||||
|
||||
if (expected == actual) return; /* Both are NULL or same pointer */
|
||||
if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
if (expected == actual)
|
||||
{
|
||||
return; /* Both are NULL or same pointer */
|
||||
}
|
||||
|
||||
while (elements--)
|
||||
if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
|
||||
{
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
|
||||
while ((elements > 0) && elements--)
|
||||
{
|
||||
UNITY_INT expect_val;
|
||||
UNITY_INT actual_val;
|
||||
@@ -733,13 +755,13 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
||||
/*-----------------------------------------------*/
|
||||
#ifndef UNITY_EXCLUDE_FLOAT
|
||||
/* Wrap this define in a function with variable types as float or double */
|
||||
#define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
|
||||
if (isinf(expected) && isinf(actual) && ((expected < 0) == (actual < 0))) return 1; \
|
||||
if (UNITY_NAN_CHECK) return 1; \
|
||||
diff = actual - expected; \
|
||||
if (diff < 0) diff = -diff; \
|
||||
if (delta < 0) delta = -delta; \
|
||||
return !(isnan(diff) || isinf(diff) || (diff > delta))
|
||||
#define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
|
||||
if (isinf(expected) && isinf(actual) && (((expected) < 0) == ((actual) < 0))) return 1; \
|
||||
if (UNITY_NAN_CHECK) return 1; \
|
||||
(diff) = (actual) - (expected); \
|
||||
if ((diff) < 0) (diff) = -(diff); \
|
||||
if ((delta) < 0) (delta) = -(delta); \
|
||||
return !(isnan(diff) || isinf(diff) || ((diff) > (delta)))
|
||||
/* This first part of this condition will catch any NaN or Infinite values */
|
||||
#ifndef UNITY_NAN_NOT_EQUAL_NAN
|
||||
#define UNITY_NAN_CHECK isnan(expected) && isnan(actual)
|
||||
@@ -759,12 +781,14 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
||||
UnityPrint(UnityStrDelta)
|
||||
#endif /* UNITY_EXCLUDE_FLOAT_PRINT */
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
static int UnityFloatsWithin(UNITY_FLOAT delta, UNITY_FLOAT expected, UNITY_FLOAT actual)
|
||||
{
|
||||
UNITY_FLOAT diff;
|
||||
UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
|
||||
UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
|
||||
const UNITY_UINT32 num_elements,
|
||||
@@ -783,9 +807,15 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
|
||||
UnityPrintPointlessAndBail();
|
||||
}
|
||||
|
||||
if (expected == actual) return; /* Both are NULL or same pointer */
|
||||
if (expected == actual)
|
||||
{
|
||||
return; /* Both are NULL or same pointer */
|
||||
}
|
||||
|
||||
if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
|
||||
{
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
|
||||
while (elements--)
|
||||
{
|
||||
@@ -870,14 +900,18 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrExpected);
|
||||
if (!should_be_trait)
|
||||
{
|
||||
UnityPrint(UnityStrNot);
|
||||
}
|
||||
UnityPrint(trait_names[trait_index]);
|
||||
UnityPrint(UnityStrWas);
|
||||
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
||||
UnityPrintFloat((UNITY_DOUBLE)actual);
|
||||
#else
|
||||
if (should_be_trait)
|
||||
{
|
||||
UnityPrint(UnityStrNot);
|
||||
}
|
||||
UnityPrint(trait_names[trait_index]);
|
||||
#endif
|
||||
UnityAddMsgIfSpecified(msg);
|
||||
@@ -895,6 +929,7 @@ static int UnityDoublesWithin(UNITY_DOUBLE delta, UNITY_DOUBLE expected, UNITY_D
|
||||
UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
|
||||
UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
|
||||
const UNITY_UINT32 num_elements,
|
||||
@@ -913,9 +948,15 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expecte
|
||||
UnityPrintPointlessAndBail();
|
||||
}
|
||||
|
||||
if (expected == actual) return; /* Both are NULL or same pointer */
|
||||
if (expected == actual)
|
||||
{
|
||||
return; /* Both are NULL or same pointer */
|
||||
}
|
||||
|
||||
if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
|
||||
{
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
|
||||
while (elements--)
|
||||
{
|
||||
@@ -955,7 +996,6 @@ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
|
||||
void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber,
|
||||
@@ -1000,14 +1040,18 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrExpected);
|
||||
if (!should_be_trait)
|
||||
{
|
||||
UnityPrint(UnityStrNot);
|
||||
}
|
||||
UnityPrint(trait_names[trait_index]);
|
||||
UnityPrint(UnityStrWas);
|
||||
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
||||
UnityPrintFloat(actual);
|
||||
#else
|
||||
if (should_be_trait)
|
||||
{
|
||||
UnityPrint(UnityStrNot);
|
||||
}
|
||||
UnityPrint(trait_names[trait_index]);
|
||||
#endif
|
||||
UnityAddMsgIfSpecified(msg);
|
||||
@@ -1030,16 +1074,24 @@ void UnityAssertNumbersWithin(const UNITY_UINT delta,
|
||||
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
|
||||
{
|
||||
if (actual > expected)
|
||||
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
|
||||
{
|
||||
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((UNITY_UINT)actual > (UNITY_UINT)expected)
|
||||
{
|
||||
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
|
||||
}
|
||||
}
|
||||
|
||||
if (Unity.CurrentTestFailed)
|
||||
@@ -1235,9 +1287,15 @@ void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
|
||||
UnityPrintPointlessAndBail();
|
||||
}
|
||||
|
||||
if (expected == actual) return; /* Both are NULL or same pointer */
|
||||
if (expected == actual)
|
||||
{
|
||||
return; /* Both are NULL or same pointer */
|
||||
}
|
||||
|
||||
if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
|
||||
{
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
|
||||
while (elements--)
|
||||
{
|
||||
@@ -1314,6 +1372,7 @@ UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
|
||||
}
|
||||
|
||||
#ifndef UNITY_EXCLUDE_FLOAT
|
||||
/*-----------------------------------------------*/
|
||||
UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
|
||||
{
|
||||
UnityQuickCompare.f = num;
|
||||
@@ -1322,6 +1381,7 @@ UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||
/*-----------------------------------------------*/
|
||||
UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
|
||||
{
|
||||
UnityQuickCompare.d = num;
|
||||
@@ -1333,6 +1393,7 @@ UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
|
||||
* Control Functions
|
||||
*-----------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
|
||||
{
|
||||
RETURN_IF_FAIL_OR_IGNORE;
|
||||
@@ -1412,6 +1473,7 @@ void UnityBegin(const char* filename)
|
||||
Unity.TestIgnores = 0;
|
||||
Unity.CurrentTestFailed = 0;
|
||||
Unity.CurrentTestIgnored = 0;
|
||||
UNITY_EXEC_TIME_RESET();
|
||||
|
||||
UNITY_CLR_DETAILS();
|
||||
UNITY_OUTPUT_START();
|
||||
@@ -1456,6 +1518,7 @@ char* UnityOptionIncludeNamed = NULL;
|
||||
char* UnityOptionExcludeNamed = NULL;
|
||||
int UnityVerbosity = 1;
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
int UnityParseOptions(int argc, char** argv)
|
||||
{
|
||||
UnityOptionIncludeNamed = NULL;
|
||||
@@ -1472,9 +1535,13 @@ int UnityParseOptions(int argc, char** argv)
|
||||
case 'n': /* include tests with name including this string */
|
||||
case 'f': /* an alias for -n */
|
||||
if (argv[i][2] == '=')
|
||||
{
|
||||
UnityOptionIncludeNamed = &argv[i][3];
|
||||
}
|
||||
else if (++i < argc)
|
||||
{
|
||||
UnityOptionIncludeNamed = argv[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityPrint("ERROR: No Test String to Include Matches For");
|
||||
@@ -1490,9 +1557,13 @@ int UnityParseOptions(int argc, char** argv)
|
||||
break;
|
||||
case 'x': /* exclude tests with name including this string */
|
||||
if (argv[i][2] == '=')
|
||||
{
|
||||
UnityOptionExcludeNamed = &argv[i][3];
|
||||
}
|
||||
else if (++i < argc)
|
||||
{
|
||||
UnityOptionExcludeNamed = argv[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityPrint("ERROR: No Test String to Exclude Matches For");
|
||||
@@ -1512,6 +1583,7 @@ int UnityParseOptions(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
||||
{
|
||||
const char* lptr = longstring;
|
||||
@@ -1519,7 +1591,9 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
||||
const char* lnext = lptr;
|
||||
|
||||
if (*sptr == '*')
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (*lptr)
|
||||
{
|
||||
@@ -1550,9 +1624,11 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
||||
lptr = lnext;
|
||||
sptr = shortstring;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
int UnityStringArgumentMatches(const char* str)
|
||||
{
|
||||
int retval;
|
||||
@@ -1565,7 +1641,9 @@ int UnityStringArgumentMatches(const char* str)
|
||||
while (ptr1[0] != 0)
|
||||
{
|
||||
if ((ptr1[0] == '"') || (ptr1[0] == '\''))
|
||||
{
|
||||
ptr1++;
|
||||
}
|
||||
|
||||
/* look for the start of the next partial */
|
||||
ptr2 = ptr1;
|
||||
@@ -1574,26 +1652,37 @@ int UnityStringArgumentMatches(const char* str)
|
||||
{
|
||||
ptr2++;
|
||||
if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
|
||||
{
|
||||
ptrf = &ptr2[1];
|
||||
}
|
||||
} while ((ptr2[0] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','));
|
||||
|
||||
while ((ptr2[0] != 0) && ((ptr2[0] == ':') || (ptr2[0] == '\'') || (ptr2[0] == '"') || (ptr2[0] == ',')))
|
||||
{
|
||||
ptr2++;
|
||||
}
|
||||
|
||||
/* done if complete filename match */
|
||||
retval = IsStringInBiggerString(Unity.TestFile, ptr1);
|
||||
if (retval == 1)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* done if testname match after filename partial match */
|
||||
if ((retval == 2) && (ptrf != 0))
|
||||
{
|
||||
if (IsStringInBiggerString(Unity.CurrentTestName, ptrf))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* done if complete testname match */
|
||||
if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
ptr1 = ptr2;
|
||||
}
|
||||
@@ -1602,6 +1691,7 @@ int UnityStringArgumentMatches(const char* str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
int UnityTestMatches(void)
|
||||
{
|
||||
/* Check if this test name matches the included test pattern */
|
||||
@@ -1611,14 +1701,19 @@ int UnityTestMatches(void)
|
||||
retval = UnityStringArgumentMatches(UnityOptionIncludeNamed);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
/* Check if this test name matches the excluded test pattern */
|
||||
if (UnityOptionExcludeNamed)
|
||||
{
|
||||
if (UnityStringArgumentMatches(UnityOptionExcludeNamed))
|
||||
{
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -402,8 +402,8 @@ int suiteTearDown(int num_failures);
|
||||
#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_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_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((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))
|
||||
|
||||
/* 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))
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* Unity Attempts to Auto-Detect Integer Types
|
||||
* Attempt 1: UINT_MAX, ULONG_MAX in <limits.h>, or default to 32 bits
|
||||
* Attempt 2: UINTPTR_MAX in <stdint.h>, or default to same size as long
|
||||
@@ -32,6 +36,10 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Guess Widths If Not Specified
|
||||
*-------------------------------------------------------*/
|
||||
@@ -241,30 +249,30 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
|
||||
* Output Method: stdout (DEFAULT)
|
||||
*-------------------------------------------------------*/
|
||||
#ifndef UNITY_OUTPUT_CHAR
|
||||
/* Default to using putchar, which is defined in stdio.h */
|
||||
#include <stdio.h>
|
||||
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
|
||||
/* Default to using putchar, which is defined in stdio.h */
|
||||
#include <stdio.h>
|
||||
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
|
||||
#else
|
||||
/* If defined as something else, make sure we declare it here so it's ready for use */
|
||||
#ifdef UNITY_OUTPUT_CHAR_HEADER_DECLARATION
|
||||
extern void UNITY_OUTPUT_CHAR_HEADER_DECLARATION;
|
||||
extern void UNITY_OUTPUT_CHAR_HEADER_DECLARATION;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_OUTPUT_FLUSH
|
||||
#ifdef UNITY_USE_FLUSH_STDOUT
|
||||
/* We want to use the stdout flush utility */
|
||||
#include <stdio.h>
|
||||
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
|
||||
#ifdef UNITY_USE_FLUSH_STDOUT
|
||||
/* We want to use the stdout flush utility */
|
||||
#include <stdio.h>
|
||||
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
|
||||
#else
|
||||
/* We've specified nothing, therefore flush should just be ignored */
|
||||
#define UNITY_OUTPUT_FLUSH()
|
||||
#endif
|
||||
#else
|
||||
/* We've specified nothing, therefore flush should just be ignored */
|
||||
#define UNITY_OUTPUT_FLUSH()
|
||||
#endif
|
||||
#else
|
||||
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
|
||||
#ifdef UNITY_OUTPUT_FLUSH_HEADER_DECLARATION
|
||||
extern void UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION;
|
||||
#endif
|
||||
/* If defined as something else, make sure we declare it here so it's ready for use */
|
||||
#ifdef UNITY_OUTPUT_FLUSH_HEADER_DECLARATION
|
||||
extern void UNITY_OUTPUT_FLUSH_HEADER_DECLARATION;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_OUTPUT_FLUSH
|
||||
@@ -285,6 +293,44 @@ extern void UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION;
|
||||
#define UNITY_OUTPUT_COMPLETE()
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXEC_TIME_RESET
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_EXEC_TIME_RESET()\
|
||||
Unity.CurrentTestStartTime = 0;\
|
||||
Unity.CurrentTestStopTime = 0;
|
||||
#else
|
||||
#define UNITY_EXEC_TIME_RESET()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXEC_TIME_START
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_EXEC_TIME_START() Unity.CurrentTestStartTime = UNITY_CLOCK_MS();
|
||||
#else
|
||||
#define UNITY_EXEC_TIME_START()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXEC_TIME_STOP
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_EXEC_TIME_STOP() Unity.CurrentTestStopTime = UNITY_CLOCK_MS();
|
||||
#else
|
||||
#define UNITY_EXEC_TIME_STOP()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_PRINT_EXEC_TIME
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_PRINT_EXEC_TIME() \
|
||||
UnityPrint(" (");\
|
||||
UNITY_COUNTER_TYPE execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime);\
|
||||
UnityPrintNumberUnsigned(execTimeMs);\
|
||||
UnityPrint(" ms)");
|
||||
#else
|
||||
#define UNITY_PRINT_EXEC_TIME()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Footprint
|
||||
*-------------------------------------------------------*/
|
||||
@@ -313,7 +359,6 @@ extern void UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION;
|
||||
# undef UNITY_WEAK_PRAGMA
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Internal Structs Needed
|
||||
*-------------------------------------------------------*/
|
||||
@@ -354,11 +399,13 @@ UNITY_DISPLAY_STYLE_UINT = sizeof(unsigned) + UNITY_DISPLAY_RANGE_UINT,
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UNITY_WITHIN = 0,
|
||||
UNITY_EQUAL_TO = 1,
|
||||
UNITY_GREATER_THAN = 2,
|
||||
UNITY_GREATER_OR_EQUAL = 2 + UNITY_EQUAL_TO,
|
||||
UNITY_SMALLER_THAN = 4,
|
||||
UNITY_SMALLER_OR_EQUAL = 4 + UNITY_EQUAL_TO
|
||||
UNITY_SMALLER_OR_EQUAL = 4 + UNITY_EQUAL_TO,
|
||||
UNITY_UNKNOWN
|
||||
} UNITY_COMPARISON_T;
|
||||
|
||||
#ifndef UNITY_EXCLUDE_FLOAT
|
||||
@@ -379,7 +426,8 @@ typedef enum UNITY_FLOAT_TRAIT
|
||||
typedef enum
|
||||
{
|
||||
UNITY_ARRAY_TO_VAL = 0,
|
||||
UNITY_ARRAY_TO_ARRAY
|
||||
UNITY_ARRAY_TO_ARRAY,
|
||||
UNITY_ARRAY_UNKNOWN
|
||||
} UNITY_FLAGS_T;
|
||||
|
||||
struct UNITY_STORAGE_T
|
||||
@@ -396,6 +444,10 @@ struct UNITY_STORAGE_T
|
||||
UNITY_COUNTER_TYPE TestIgnores;
|
||||
UNITY_COUNTER_TYPE CurrentTestFailed;
|
||||
UNITY_COUNTER_TYPE CurrentTestIgnored;
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
UNITY_COUNTER_TYPE CurrentTestStartTime;
|
||||
UNITY_COUNTER_TYPE CurrentTestStopTime;
|
||||
#endif
|
||||
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||
jmp_buf AbortFrame;
|
||||
#endif
|
||||
@@ -422,8 +474,8 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
|
||||
#define UNITY_SET_DETAILS(d1,d2)
|
||||
#else
|
||||
#define UNITY_CLR_DETAILS() { Unity.CurrentDetail1 = 0; Unity.CurrentDetail2 = 0; }
|
||||
#define UNITY_SET_DETAIL(d1) { Unity.CurrentDetail1 = d1; Unity.CurrentDetail2 = 0; }
|
||||
#define UNITY_SET_DETAILS(d1,d2) { Unity.CurrentDetail1 = d1; Unity.CurrentDetail2 = d2; }
|
||||
#define UNITY_SET_DETAIL(d1) { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = 0; }
|
||||
#define UNITY_SET_DETAILS(d1,d2) { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = (d2); }
|
||||
|
||||
#ifndef UNITY_DETAIL1_NAME
|
||||
#define UNITY_DETAIL1_NAME "Function"
|
||||
@@ -442,9 +494,9 @@ void UnityPrint(const char* string);
|
||||
void UnityPrintLen(const char* string, const UNITY_UINT32 length);
|
||||
void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number);
|
||||
void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style);
|
||||
void UnityPrintNumber(const UNITY_INT number);
|
||||
void UnityPrintNumber(const UNITY_INT number_to_print);
|
||||
void UnityPrintNumberUnsigned(const UNITY_UINT number);
|
||||
void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles);
|
||||
void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print);
|
||||
|
||||
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
||||
void UnityPrintFloat(const UNITY_DOUBLE input_number);
|
||||
@@ -594,6 +646,12 @@ extern const char UnityStrErr64[];
|
||||
#define TEST_ABORT() return
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_TIME_H
|
||||
#define UNITY_CLOCK_MS() (UNITY_COUNTER_TYPE)((clock() * 1000) / CLOCKS_PER_SEC)
|
||||
#else
|
||||
#define UNITY_CLOCK_MS()
|
||||
#endif
|
||||
|
||||
/* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */
|
||||
#ifndef RUN_TEST
|
||||
#ifdef __STDC_VERSION__
|
||||
@@ -748,18 +806,18 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((UNITY_INTERNAL_PTR)(expected), (const char**)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) expected, sizeof(int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )expected, 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )expected, 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )expected, 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) expected, sizeof(unsigned int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT8 )expected, 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT16)expected, 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT32)expected, 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )expected, 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )expected, 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )expected, 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_PTR_TO_INT) expected, sizeof(int*)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), sizeof(int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), sizeof(unsigned int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT16)(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT32)(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_PTR_TO_INT) (expected), sizeof(int*)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_STRING(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((UNITY_INTERNAL_PTR)(expected), (const char**)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
|
||||
@@ -770,9 +828,9 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||
@@ -854,10 +912,10 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#else
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((UNITY_DOUBLE)(delta), (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((UNITY_DOUBLE)(expected) * (UNITY_DOUBLE)UNITY_DOUBLE_PRECISION, (UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual, (UNITY_LINE_TYPE)(line), message)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((UNITY_DOUBLE*)(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray(UnityDoubleToPtr(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((UNITY_DOUBLE)(delta), (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((UNITY_DOUBLE)(expected) * (UNITY_DOUBLE)UNITY_DOUBLE_PRECISION, (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (UNITY_LINE_TYPE)(line), (message))
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((UNITY_DOUBLE*)(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray(UnityDoubleToPtr(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
|
||||
|
||||
Reference in New Issue
Block a user