mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-10-11 19:27:24 +00:00
Added new asserts to check for plus/minus infinity and NaN.
This commit is contained in:
+141
@@ -28,6 +28,9 @@ const char* UnityStrDelta = " Values Not Within Delta ";
|
|||||||
const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless.";
|
const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless.";
|
||||||
const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL";
|
const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL";
|
||||||
const char* UnityStrNullPointerForActual = " Actual pointer was NULL";
|
const char* UnityStrNullPointerForActual = " Actual pointer was NULL";
|
||||||
|
const char* UnityStrInf = "Infinity";
|
||||||
|
const char* UnityStrNegInf = "Negative Infinity";
|
||||||
|
const char* UnityStrNaN = "NaN";
|
||||||
|
|
||||||
// compiler-generic print formatting masks
|
// compiler-generic print formatting masks
|
||||||
const _U_UINT UnitySizeMask[] =
|
const _U_UINT UnitySizeMask[] =
|
||||||
@@ -595,6 +598,75 @@ void UnityAssertFloatsWithin(const _UF delta,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
void UnityAssertFloatIsInf(const _UF actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber)
|
||||||
|
{
|
||||||
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if ((1.0f / 0.0f) != actual)
|
||||||
|
{
|
||||||
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
|
#ifdef UNITY_FLOAT_VERBOSE
|
||||||
|
UnityPrint(UnityStrExpected);
|
||||||
|
UnityPrint(UnityStrInf);
|
||||||
|
UnityPrint(UnityStrWas);
|
||||||
|
UnityPrintFloat(actual);
|
||||||
|
#else
|
||||||
|
UnityPrint(UnityStrDelta);
|
||||||
|
#endif
|
||||||
|
UnityAddMsgIfSpecified(msg);
|
||||||
|
UNITY_FAIL_AND_BAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
void UnityAssertFloatIsNegInf(const _UF actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber)
|
||||||
|
{
|
||||||
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if ((-1.0f / 0.0f) != actual)
|
||||||
|
{
|
||||||
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
|
#ifdef UNITY_FLOAT_VERBOSE
|
||||||
|
UnityPrint(UnityStrExpected);
|
||||||
|
UnityPrint(UnityStrNegInf);
|
||||||
|
UnityPrint(UnityStrWas);
|
||||||
|
UnityPrintFloat(actual);
|
||||||
|
#else
|
||||||
|
UnityPrint(UnityStrDelta);
|
||||||
|
#endif
|
||||||
|
UnityAddMsgIfSpecified(msg);
|
||||||
|
UNITY_FAIL_AND_BAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
void UnityAssertFloatIsNaN(const _UF actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber)
|
||||||
|
{
|
||||||
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if (actual == actual)
|
||||||
|
{
|
||||||
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
|
#ifdef UNITY_FLOAT_VERBOSE
|
||||||
|
UnityPrint(UnityStrExpected);
|
||||||
|
UnityPrint(UnityStrNaN);
|
||||||
|
UnityPrint(UnityStrWas);
|
||||||
|
UnityPrintFloat(actual);
|
||||||
|
#else
|
||||||
|
UnityPrint(UnityStrDelta);
|
||||||
|
#endif
|
||||||
|
UnityAddMsgIfSpecified(msg);
|
||||||
|
UNITY_FAIL_AND_BAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif //not UNITY_EXCLUDE_FLOAT
|
#endif //not UNITY_EXCLUDE_FLOAT
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
@@ -690,6 +762,75 @@ void UnityAssertDoublesWithin(const _UD delta,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
void UnityAssertDoubleIsInf(const _UD actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber)
|
||||||
|
{
|
||||||
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if ((1.0 / 0.0) != actual)
|
||||||
|
{
|
||||||
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
|
#ifdef UNITY_DOUBLE_VERBOSE
|
||||||
|
UnityPrint(UnityStrExpected);
|
||||||
|
UnityPrint(UnityStrInf);
|
||||||
|
UnityPrint(UnityStrWas);
|
||||||
|
UnityPrintFloat((float)actual);
|
||||||
|
#else
|
||||||
|
UnityPrint(UnityStrDelta);
|
||||||
|
#endif
|
||||||
|
UnityAddMsgIfSpecified(msg);
|
||||||
|
UNITY_FAIL_AND_BAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
void UnityAssertDoubleIsNegInf(const _UD actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber)
|
||||||
|
{
|
||||||
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if ((-1.0 / 0.0) != actual)
|
||||||
|
{
|
||||||
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
|
#ifdef UNITY_DOUBLE_VERBOSE
|
||||||
|
UnityPrint(UnityStrExpected);
|
||||||
|
UnityPrint(UnityStrNegInf);
|
||||||
|
UnityPrint(UnityStrWas);
|
||||||
|
UnityPrintFloat((float)actual);
|
||||||
|
#else
|
||||||
|
UnityPrint(UnityStrDelta);
|
||||||
|
#endif
|
||||||
|
UnityAddMsgIfSpecified(msg);
|
||||||
|
UNITY_FAIL_AND_BAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
void UnityAssertDoubleIsNaN(const _UD actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber)
|
||||||
|
{
|
||||||
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if (actual == actual)
|
||||||
|
{
|
||||||
|
UnityTestResultsFailBegin(lineNumber);
|
||||||
|
#ifdef UNITY_DOUBLE_VERBOSE
|
||||||
|
UnityPrint(UnityStrExpected);
|
||||||
|
UnityPrint(UnityStrNaN);
|
||||||
|
UnityPrint(UnityStrWas);
|
||||||
|
UnityPrintFloat((float)actual);
|
||||||
|
#else
|
||||||
|
UnityPrint(UnityStrDelta);
|
||||||
|
#endif
|
||||||
|
UnityAddMsgIfSpecified(msg);
|
||||||
|
UNITY_FAIL_AND_BAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // not UNITY_EXCLUDE_DOUBLE
|
#endif // not UNITY_EXCLUDE_DOUBLE
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
|||||||
+6
-1
@@ -142,12 +142,17 @@
|
|||||||
#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL)
|
#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_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_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __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_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __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)
|
||||||
|
|
||||||
//Double (If Enabled)
|
//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_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_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_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, __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_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, __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)
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// Test Asserts (with additional messages)
|
// Test Asserts (with additional messages)
|
||||||
|
|||||||
@@ -410,6 +410,18 @@ void UnityAssertEqualFloatArray(const _UF* expected,
|
|||||||
const _UU32 num_elements,
|
const _UU32 num_elements,
|
||||||
const char* msg,
|
const char* msg,
|
||||||
const UNITY_LINE_TYPE lineNumber);
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertFloatIsInf(const _UF actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertFloatIsNegInf(const _UF actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertFloatIsNaN(const _UF actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UNITY_EXCLUDE_DOUBLE
|
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||||
@@ -424,6 +436,18 @@ void UnityAssertEqualDoubleArray(const _UD* expected,
|
|||||||
const _UU32 num_elements,
|
const _UU32 num_elements,
|
||||||
const char* msg,
|
const char* msg,
|
||||||
const UNITY_LINE_TYPE lineNumber);
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertDoubleIsInf(const _UD actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertDoubleIsNegInf(const _UD actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertDoubleIsNaN(const _UD actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
@@ -493,20 +517,32 @@ void UnityAssertEqualDoubleArray(const _UD* expected,
|
|||||||
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Floating Point Disabled")
|
||||||
#else
|
#else
|
||||||
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message)
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message)
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UnityAssertFloatIsInf((_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UnityAssertFloatIsNegInf((_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UnityAssertFloatIsNaN((_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
|
||||||
#else
|
#else
|
||||||
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((_UD)(delta), (_UD)(expected), (_UD)(actual), (message), (UNITY_LINE_TYPE)line)
|
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((_UD)(delta), (_UD)(expected), (_UD)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((_UF)(expected) * (_UD)UNITY_DOUBLE_PRECISION, (_UD)expected, (_UD)actual, (UNITY_LINE_TYPE)line, message)
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((_UF)(expected) * (_UD)UNITY_DOUBLE_PRECISION, (_UD)expected, (_UD)actual, (UNITY_LINE_TYPE)line, message)
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((_UD*)(expected), (_UD*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((_UD*)(expected), (_UD*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UnityAssertFloatIsInf((_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UnityAssertFloatIsNegInf((_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UnityAssertFloatIsNaN((_UF)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2325,6 +2325,80 @@ void testFloatsNotEqualPlusMinusInf(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testFloatIsInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
TEST_ASSERT_FLOAT_IS_INF(2.0f / 0.0f);
|
||||||
|
TEST_ASSERT_FLOAT_IS_NEG_INF(-3.0f / 0.0f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFloatIsNotInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_FLOAT_IS_INF(2.0f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFloatIsNotNegInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_FLOAT_IS_NEG_INF(-999.876f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFloatIsNan(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
TEST_ASSERT_FLOAT_IS_NAN(0.0f / 0.0f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFloatIsNotNan(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_FLOAT_IS_NAN(234.9f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFloatInfIsNotNan(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_FLOAT_IS_NAN(1.0f / 0.0f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFloatNanIsNotInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_FLOAT_IS_INF(0.0f / 0.0f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void testEqualFloatArrays(void)
|
void testEqualFloatArrays(void)
|
||||||
{
|
{
|
||||||
#ifdef UNITY_EXCLUDE_FLOAT
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
@@ -2625,6 +2699,80 @@ void testDoublesNotEqualPlusMinusInf(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testDoubleIsInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
TEST_ASSERT_DOUBLE_IS_INF(2.0f / 0.0f);
|
||||||
|
TEST_ASSERT_DOUBLE_IS_NEG_INF(-3.0f / 0.0f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testDoubleIsNotInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_DOUBLE_IS_INF(2.0f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testDoubleIsNotNegInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_DOUBLE_IS_NEG_INF(-999.876f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testDoubleIsNan(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
TEST_ASSERT_DOUBLE_IS_NAN(0.0f / 0.0f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testDoubleIsNotNan(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_DOUBLE_IS_NAN(234.9f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testDoubleInfIsNotNan(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_DOUBLE_IS_NAN(1.0f / 0.0f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void testDoubleNanIsNotInf(void)
|
||||||
|
{
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
TEST_IGNORE();
|
||||||
|
#else
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_DOUBLE_IS_INF(0.0f / 0.0f);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void testEqualDoubleArrays(void)
|
void testEqualDoubleArrays(void)
|
||||||
{
|
{
|
||||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
|||||||
Reference in New Issue
Block a user