mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-05-20 17:07:32 +08:00
Merge pull request #560 from jonathangjertsen/more-float
Add macros for testing inequalities between floats, doubles
This commit is contained in:
22
README.md
22
README.md
@ -142,14 +142,36 @@ The bit is specified 0-31 for a 32-bit integer.
|
||||
### Numerical Assertions: Floats
|
||||
|
||||
TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual)
|
||||
TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual)
|
||||
|
||||
Asserts that the actual value is within plus or minus delta of the expected value.
|
||||
|
||||
TEST_ASSERT_FLOAT_NOT_WITHIN(delta, expected, actual)
|
||||
TEST_ASSERT_DOUBLE_NOT_WITHIN(delta, expected, actual)
|
||||
|
||||
Asserts that the actual value is NOT within plus or minus delta of the expected value.
|
||||
|
||||
TEST_ASSERT_EQUAL_FLOAT(expected, actual)
|
||||
TEST_ASSERT_EQUAL_DOUBLE(expected, actual)
|
||||
|
||||
Asserts that two floating point values are "equal" within a small % delta of the expected value.
|
||||
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(expected, actual)
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(expected, actual)
|
||||
|
||||
Asserts that two floating point values are NOT "equal" within a small % delta of the expected value.
|
||||
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(threshold, actual)
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(threshold, actual)
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(threshold, actual)
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(threshold, actual)
|
||||
|
||||
Asserts that the actual value is less than or greater than the threshold.
|
||||
|
||||
There are also `LESS_OR_EQUAL` and `GREATER_OR_EQUAL` variations.
|
||||
These obey the same rules for equality as do `TEST_ASSERT_EQUAL_FLOAT` and `TEST_ASSERT_EQUAL_DOUBLE`:
|
||||
If the two values are within a small % delta of the expected value, the assertion will pass.
|
||||
|
||||
### String Assertions
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING(expected, actual)
|
||||
|
@ -555,21 +555,52 @@ Asserts that the `actual` value is within +/- `delta` of the `expected` value.
|
||||
The nature of floating point representation is such that exact evaluations of
|
||||
equality are not guaranteed.
|
||||
|
||||
#### `TEST_ASSERT_FLOAT_WITHIN (delta, expected, actual)`
|
||||
|
||||
Asserts that the `actual` value is NOT within +/- `delta` of the `expected` value.
|
||||
|
||||
#### `TEST_ASSERT_EQUAL_FLOAT (expected, actual)`
|
||||
|
||||
Asserts that the ?actual?value is "close enough to be considered equal" to the
|
||||
Asserts that the `actual` value is "close enough to be considered equal" to the
|
||||
`expected` value. If you are curious about the details, refer to the Advanced
|
||||
Asserting section for more details on this. Omitting a user-specified delta in a
|
||||
floating point assertion is both a shorthand convenience and a requirement of
|
||||
code generation conventions for CMock.
|
||||
|
||||
#### `TEST_ASSERT_NOT_EQUAL_FLOAT (expected, actual)`
|
||||
|
||||
Asserts that the `actual` value is NOT "close enough to be considered equal" to the
|
||||
`expected` value.
|
||||
|
||||
#### `TEST_ASSERT_EQUAL_FLOAT_ARRAY (expected, actual, num_elements)`
|
||||
|
||||
See Array assertion section for details. Note that individual array element
|
||||
float comparisons are executed using T?EST_ASSERT_EQUAL_FLOAT?.That is, user
|
||||
float comparisons are executed using `TEST_ASSERT_EQUAL_FLOAT`.That is, user
|
||||
specified delta comparison values requires a custom-implemented floating point
|
||||
array assertion.
|
||||
|
||||
#### `TEST_ASSERT_LESS_THAN_FLOAT (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is less than `threshold` (exclusive).
|
||||
For example, if the threshold value is 1.0f, the assertion will fail if it is
|
||||
greater than 1.0f.
|
||||
|
||||
#### `TEST_ASSERT_GREATER_THAN_FLOAT (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is greater than `threshold` (exclusive).
|
||||
For example, if the threshold value is 1.0f, the assertion will fail if it is
|
||||
less than 1.0f.
|
||||
|
||||
#### `TEST_ASSERT_LESS_OR_EQUAL_FLOAT (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is less than or equal to `threshold`.
|
||||
The rules for equality are the same as for `TEST_ASSERT_EQUAL_FLOAT`.
|
||||
|
||||
#### `TEST_ASSERT_GREATER_OR_EQUAL_FLOAT (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is greater than `threshold`.
|
||||
The rules for equality are the same as for `TEST_ASSERT_EQUAL_FLOAT`.
|
||||
|
||||
#### `TEST_ASSERT_FLOAT_IS_INF (actual)`
|
||||
|
||||
Asserts that `actual` parameter is equivalent to positive infinity floating
|
||||
@ -586,7 +617,7 @@ Asserts that `actual` parameter is a Not A Number floating point representation.
|
||||
|
||||
#### `TEST_ASSERT_FLOAT_IS_DETERMINATE (actual)`
|
||||
|
||||
Asserts that ?actual?parameter is a floating point representation usable for
|
||||
Asserts that `actual` parameter is a floating point representation usable for
|
||||
mathematical operations. That is, the `actual` parameter is neither positive
|
||||
infinity nor negative infinity nor Not A Number floating point representations.
|
||||
|
||||
@ -619,6 +650,10 @@ Asserts that the `actual` value is within +/- `delta` of the `expected` value.
|
||||
The nature of floating point representation is such that exact evaluations of
|
||||
equality are not guaranteed.
|
||||
|
||||
#### `TEST_ASSERT_DOUBLE_NOT_WITHIN (delta, expected, actual)`
|
||||
|
||||
Asserts that the `actual` value is NOT within +/- `delta` of the `expected` value.
|
||||
|
||||
#### `TEST_ASSERT_EQUAL_DOUBLE (expected, actual)`
|
||||
|
||||
Asserts that the `actual` value is "close enough to be considered equal" to the
|
||||
@ -627,6 +662,11 @@ Asserting section for more details. Omitting a user-specified delta in a
|
||||
floating point assertion is both a shorthand convenience and a requirement of
|
||||
code generation conventions for CMock.
|
||||
|
||||
#### `TEST_ASSERT_NOT_EQUAL_DOUBLE (expected, actual)`
|
||||
|
||||
Asserts that the `actual` value is NOT "close enough to be considered equal" to the
|
||||
`expected` value.
|
||||
|
||||
#### `TEST_ASSERT_EQUAL_DOUBLE_ARRAY (expected, actual, num_elements)`
|
||||
|
||||
See Array assertion section for details. Note that individual array element
|
||||
@ -634,6 +674,28 @@ double comparisons are executed using `TEST_ASSERT_EQUAL_DOUBLE`.That is, user
|
||||
specified delta comparison values requires a custom implemented double array
|
||||
assertion.
|
||||
|
||||
#### `TEST_ASSERT_LESS_THAN_DOUBLE (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is less than `threshold` (exclusive).
|
||||
For example, if the threshold value is 1.0, the assertion will fail if it is
|
||||
greater than 1.0.
|
||||
|
||||
#### `TEST_ASSERT_LESS_OR_EQUAL_DOUBLE (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is less than or equal to `threshold`.
|
||||
The rules for equality are the same as for `TEST_ASSERT_EQUAL_DOUBLE`.
|
||||
|
||||
#### `TEST_ASSERT_GREATER_THAN_DOUBLE (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is greater than `threshold` (exclusive).
|
||||
For example, if the threshold value is 1.0, the assertion will fail if it is
|
||||
less than 1.0.
|
||||
|
||||
#### `TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE (threshold, actual)`
|
||||
|
||||
Asserts that the `actual` parameter is greater than or equal to `threshold`.
|
||||
The rules for equality are the same as for `TEST_ASSERT_EQUAL_DOUBLE`.
|
||||
|
||||
#### `TEST_ASSERT_DOUBLE_IS_INF (actual)`
|
||||
|
||||
Asserts that `actual` parameter is equivalent to positive infinity floating
|
||||
@ -651,7 +713,7 @@ Asserts that `actual` parameter is a Not A Number floating point representation.
|
||||
#### `TEST_ASSERT_DOUBLE_IS_DETERMINATE (actual)`
|
||||
|
||||
Asserts that `actual` parameter is a floating point representation usable for
|
||||
mathematical operations. That is, the ?actual?parameter is neither positive
|
||||
mathematical operations. That is, the `actual` parameter is neither positive
|
||||
infinity nor negative infinity nor Not A Number floating point representations.
|
||||
|
||||
#### `TEST_ASSERT_DOUBLE_IS_NOT_INF (actual)`
|
||||
@ -775,11 +837,11 @@ What about the times where you suddenly need to deal with something odd, like a
|
||||
affect you:
|
||||
|
||||
1. When Unity displays errors for you, it's going to pad the upper unused bits
|
||||
with zeros.
|
||||
with zeros.
|
||||
2. You're going to have to be careful of assertions that perform signed
|
||||
operations, particularly `TEST_ASSERT_INT_WITHIN`.Such assertions might wrap
|
||||
your `int` in the wrong place, and you could experience false failures. You can
|
||||
always back down to a simple `TEST_ASSERT` and do the operations yourself.
|
||||
operations, particularly `TEST_ASSERT_INT_WITHIN`. Such assertions might wrap
|
||||
your `int` in the wrong place, and you could experience false failures. You can
|
||||
always back down to a simple `TEST_ASSERT` and do the operations yourself.
|
||||
|
||||
*Find The Latest of This And More at [ThrowTheSwitch.org][]*
|
||||
|
||||
|
108
src/unity.c
108
src/unity.c
@ -1000,6 +1000,60 @@ void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertFloatsNotWithin(const UNITY_FLOAT delta,
|
||||
const UNITY_FLOAT expected,
|
||||
const UNITY_FLOAT actual,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber)
|
||||
{
|
||||
RETURN_IF_FAIL_OR_IGNORE;
|
||||
|
||||
if (UnityFloatsWithin(delta, expected, actual))
|
||||
{
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrExpected);
|
||||
UnityPrintFloat((UNITY_DOUBLE)expected);
|
||||
UnityPrint(UnityStrNotEqual);
|
||||
UnityPrintFloat((UNITY_DOUBLE)actual);
|
||||
UnityAddMsgIfSpecified(msg);
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertGreaterOrLessFloat(const UNITY_FLOAT threshold,
|
||||
const UNITY_FLOAT actual,
|
||||
const UNITY_COMPARISON_T compare,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber)
|
||||
{
|
||||
int failed;
|
||||
|
||||
RETURN_IF_FAIL_OR_IGNORE;
|
||||
|
||||
failed = 0;
|
||||
|
||||
/* Checking for "not success" rather than failure to get the right result for NaN */
|
||||
if (!(actual < threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
|
||||
if (!(actual > threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
|
||||
|
||||
if ((compare & UNITY_EQUAL_TO) && UnityFloatsWithin(threshold * UNITY_FLOAT_PRECISION, threshold, actual)) { failed = 0; }
|
||||
|
||||
if (failed)
|
||||
{
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrExpected);
|
||||
UnityPrintFloat(actual);
|
||||
if (compare & UNITY_GREATER_THAN) { UnityPrint(UnityStrGt); }
|
||||
if (compare & UNITY_SMALLER_THAN) { UnityPrint(UnityStrLt); }
|
||||
if (compare & UNITY_EQUAL_TO) { UnityPrint(UnityStrOrEqual); }
|
||||
UnityPrintFloat(threshold);
|
||||
UnityAddMsgIfSpecified(msg);
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
||||
const char* msg,
|
||||
@ -1144,6 +1198,60 @@ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertDoublesNotWithin(const UNITY_DOUBLE delta,
|
||||
const UNITY_DOUBLE expected,
|
||||
const UNITY_DOUBLE actual,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber)
|
||||
{
|
||||
RETURN_IF_FAIL_OR_IGNORE;
|
||||
|
||||
if (UnityDoublesWithin(delta, expected, actual))
|
||||
{
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrExpected);
|
||||
UnityPrintFloat((UNITY_DOUBLE)expected);
|
||||
UnityPrint(UnityStrNotEqual);
|
||||
UnityPrintFloat((UNITY_DOUBLE)actual);
|
||||
UnityAddMsgIfSpecified(msg);
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertGreaterOrLessDouble(const UNITY_DOUBLE threshold,
|
||||
const UNITY_DOUBLE actual,
|
||||
const UNITY_COMPARISON_T compare,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber)
|
||||
{
|
||||
int failed;
|
||||
|
||||
RETURN_IF_FAIL_OR_IGNORE;
|
||||
|
||||
failed = 0;
|
||||
|
||||
/* Checking for "not success" rather than failure to get the right result for NaN */
|
||||
if (!(actual < threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
|
||||
if (!(actual > threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
|
||||
|
||||
if ((compare & UNITY_EQUAL_TO) && UnityFloatsWithin(threshold * UNITY_DOUBLE_PRECISION, threshold, actual)) { failed = 0; }
|
||||
|
||||
if (failed)
|
||||
{
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrExpected);
|
||||
UnityPrintFloat(actual);
|
||||
if (compare & UNITY_GREATER_THAN) { UnityPrint(UnityStrGt); }
|
||||
if (compare & UNITY_SMALLER_THAN) { UnityPrint(UnityStrLt); }
|
||||
if (compare & UNITY_EQUAL_TO) { UnityPrint(UnityStrOrEqual); }
|
||||
UnityPrintFloat(threshold);
|
||||
UnityAddMsgIfSpecified(msg);
|
||||
UNITY_FAIL_AND_BAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
||||
const char* msg,
|
||||
|
22
src/unity.h
22
src/unity.h
@ -337,9 +337,15 @@ void verifyTest(void);
|
||||
|
||||
/* 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_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)
|
||||
@ -351,9 +357,15 @@ void verifyTest(void);
|
||||
|
||||
/* 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_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)
|
||||
@ -607,8 +619,13 @@ void verifyTest(void);
|
||||
/* 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_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))
|
||||
@ -621,8 +638,13 @@ void verifyTest(void);
|
||||
/* 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_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))
|
||||
|
@ -670,6 +670,18 @@ void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber);
|
||||
|
||||
void UnityAssertFloatsNotWithin(const UNITY_FLOAT delta,
|
||||
const UNITY_FLOAT expected,
|
||||
const UNITY_FLOAT actual,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber);
|
||||
|
||||
void UnityAssertGreaterOrLessFloat(const UNITY_FLOAT threshold,
|
||||
const UNITY_FLOAT actual,
|
||||
const UNITY_COMPARISON_T compare,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE linenumber);
|
||||
|
||||
void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
|
||||
UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
|
||||
const UNITY_UINT32 num_elements,
|
||||
@ -690,6 +702,18 @@ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber);
|
||||
|
||||
void UnityAssertDoublesNotWithin(const UNITY_DOUBLE delta,
|
||||
const UNITY_DOUBLE expected,
|
||||
const UNITY_DOUBLE actual,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber);
|
||||
|
||||
void UnityAssertGreaterOrLessDouble(const UNITY_DOUBLE threshold,
|
||||
const UNITY_DOUBLE actual,
|
||||
const UNITY_COMPARISON_T compare,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE linenumber);
|
||||
|
||||
void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
|
||||
UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
|
||||
const UNITY_UINT32 num_elements,
|
||||
@ -1017,9 +1041,14 @@ int UnityTestMatches(void);
|
||||
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_FLOAT_NOT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_FLOAT(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_LESS_THAN_FLOAT(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_LESS_OR_EQUAL_FLOAT(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
@ -1030,9 +1059,15 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||
#else
|
||||
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((UNITY_FLOAT)(delta), (UNITY_FLOAT)(expected), (UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_FLOAT_NOT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsNotWithin((UNITY_FLOAT)(delta), (UNITY_FLOAT)(expected), (UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((UNITY_FLOAT)(expected) * (UNITY_FLOAT)UNITY_FLOAT_PRECISION, (UNITY_FLOAT)(expected), (UNITY_FLOAT)(actual), (UNITY_LINE_TYPE)(line), (message))
|
||||
#define UNITY_TEST_ASSERT_NOT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_NOT_WITHIN((UNITY_FLOAT)(expected) * (UNITY_FLOAT)UNITY_FLOAT_PRECISION, (UNITY_FLOAT)(expected), (UNITY_FLOAT)(actual), (UNITY_LINE_TYPE)(line), (message))
|
||||
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((UNITY_FLOAT*)(expected), (UNITY_FLOAT*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray(UnityFloatToPtr(expected), (UNITY_FLOAT*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_FLOAT(threshold, actual, line, message) UnityAssertGreaterOrLessFloat((UNITY_FLOAT)(threshold), (UNITY_FLOAT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(threshold, actual, line, message) UnityAssertGreaterOrLessFloat((UNITY_FLOAT)(threshold), (UNITY_FLOAT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_LESS_THAN_FLOAT(threshold, actual, line, message) UnityAssertGreaterOrLessFloat((UNITY_FLOAT)(threshold), (UNITY_FLOAT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_LESS_OR_EQUAL_FLOAT(threshold, actual, line, message) UnityAssertGreaterOrLessFloat((UNITY_FLOAT)(threshold), (UNITY_FLOAT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
|
||||
#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
|
||||
@ -1048,6 +1083,10 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_DOUBLE(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_LESS_THAN_DOUBLE(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
@ -1058,9 +1097,15 @@ int UnityTestMatches(void);
|
||||
#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_DOUBLE_NOT_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesNotWithin((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_NOT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_NOT_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_GREATER_THAN_DOUBLE(threshold, actual, line, message) UnityAssertGreaterOrLessDouble((UNITY_DOUBLE)(threshold), (UNITY_DOUBLE)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(threshold, actual, line, message) UnityAssertGreaterOrLessDouble((UNITY_DOUBLE)(threshold), (UNITY_DOUBLE)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_LESS_THAN_DOUBLE(threshold, actual, line, message) UnityAssertGreaterOrLessDouble((UNITY_DOUBLE)(threshold), (UNITY_DOUBLE)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(threshold, actual, line, message) UnityAssertGreaterOrLessDouble((UNITY_DOUBLE)(threshold), (UNITY_DOUBLE)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line))
|
||||
#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)
|
||||
|
@ -42,6 +42,10 @@ void testDoublesWithinDelta(void)
|
||||
TEST_ASSERT_DOUBLE_WITHIN(1.0, 187245.0, 187246.0);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2549, 9273.2049);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(0.007, -726.93725, -726.94424);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_DOUBLE_NOT_WITHIN(0.05, 9273.2549, 9273.2049);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -50,6 +54,8 @@ void testDoublesNotWithinDelta(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_DOUBLE_NOT_WITHIN(0.05, 9273.2649, 9273.2049);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2649, 9273.2049);
|
||||
VERIFY_FAILS_END
|
||||
@ -66,6 +72,10 @@ void testDoublesEqual(void)
|
||||
TEST_ASSERT_EQUAL_DOUBLE(187241234567.5, 187241234567.6);
|
||||
TEST_ASSERT_EQUAL_DOUBLE(9273.2512345649, 9273.25123455699);
|
||||
TEST_ASSERT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -74,6 +84,8 @@ void testDoublesNotEqual(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(9273.9649, 9273.0049);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(9273.9649, 9273.0049);
|
||||
VERIFY_FAILS_END
|
||||
@ -85,6 +97,8 @@ void testDoublesNotEqualNegative1(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(-9273.9649, -9273.0049);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(-9273.9649, -9273.0049);
|
||||
VERIFY_FAILS_END
|
||||
@ -96,6 +110,8 @@ void testDoublesNotEqualNegative2(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(-9273.0049, -9273.9649);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(-9273.0049, -9273.9649);
|
||||
VERIFY_FAILS_END
|
||||
@ -107,6 +123,8 @@ void testDoublesNotEqualActualNaN(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(85.963, 0.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(85.963, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -118,6 +136,8 @@ void testDoublesNotEqualExpectedNaN(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(0.0 / d_zero, 85.963);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 85.963);
|
||||
VERIFY_FAILS_END
|
||||
@ -130,6 +150,10 @@ void testDoublesEqualBothNaN(void)
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -138,6 +162,8 @@ void testDoublesNotEqualInfNaN(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, 0.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -149,6 +175,8 @@ void testDoublesNotEqualNaNInf(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(0.0 / d_zero, 1.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -160,6 +188,8 @@ void testDoublesNotEqualActualInf(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(321.642, 1.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(321.642, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -171,6 +201,8 @@ void testDoublesNotEqualExpectedInf(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, 321.642);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 321.642);
|
||||
VERIFY_FAILS_END
|
||||
@ -183,6 +215,10 @@ void testDoublesEqualBothInf(void)
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -191,12 +227,446 @@ void testDoublesNotEqualPlusMinusInf(void)
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, 2.0);
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0, 1.0);
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(-2.0, -1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterThanInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, 1.0 / d_zero);
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0 / d_zero, 1.0 / d_zero);
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0 / d_zero, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(2.0, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(0.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanInfActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(1.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(1.0, -1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterThanBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_DOUBLE(-1.0 / d_zero, -1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, 2.0);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(2.0, 2.0);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0, 1.0);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-2.0, -1.0);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-2.0, -2.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterOrEqualInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, 1.0 / d_zero);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0 / d_zero, 1.0 / d_zero);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0 / d_zero, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(2.0, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterOrEqualNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterOrEqualNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(0.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterOrEqualNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterOrEqualInfActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotGreaterOrEqualNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0, -1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterOrEqualBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesGreaterOrEqualBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(-1.0 / d_zero, -1.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(2.0, 1.0);
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0, -1.0);
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(-1.0, -2.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessThanInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0 / d_zero, 1.0);
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0 / d_zero, -1.0 / d_zero);
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0, -1.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0, 2.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(0.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(-1.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessThanBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_DOUBLE(-1.0 / d_zero, -1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(2.0, 1.0);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(2.0, 2.0);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, -1.0);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-1.0, -2.0);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-2.0, -2.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessOrEqualInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, -1.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, 2.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessOrEqualNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, 0.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessOrEqualNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(0.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessOrEqualNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessOrEqualInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0, 1.0 / d_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesNotLessOrEqualNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-1.0 / d_zero, 1.0);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessOrEqualBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoublesLessOrEqualBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(-1.0 / d_zero, -1.0 / d_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoubleIsPosInf1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
|
@ -42,6 +42,10 @@ void testFloatsWithinDelta(void)
|
||||
TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f);
|
||||
TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f);
|
||||
TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_FLOAT_NOT_WITHIN(0.05f, 9273.2549f, 9273.2049f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -50,6 +54,8 @@ void testFloatsNotWithinDelta(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_FLOAT_NOT_WITHIN(0.05f, 9273.2649f, 9273.2049f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f);
|
||||
VERIFY_FAILS_END
|
||||
@ -65,6 +71,10 @@ void testFloatsEqual(void)
|
||||
TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f);
|
||||
TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f);
|
||||
TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(-726.93724f, -726.9374f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -73,6 +83,8 @@ void testFloatsNotEqual(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(9273.9649f, 9273.0049f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f);
|
||||
VERIFY_FAILS_END
|
||||
@ -84,6 +96,8 @@ void testFloatsNotEqualNegative1(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(-9273.9649f, -9273.0049f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f);
|
||||
VERIFY_FAILS_END
|
||||
@ -95,6 +109,8 @@ void testFloatsNotEqualNegative2(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(-9273.0049f, -9273.9649f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f);
|
||||
VERIFY_FAILS_END
|
||||
@ -106,6 +122,8 @@ void testFloatsNotEqualActualNaN(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(85.963f, 0.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(85.963f, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -117,6 +135,8 @@ void testFloatsNotEqualExpectedNaN(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(0.0f / f_zero, 85.963f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 85.963f);
|
||||
VERIFY_FAILS_END
|
||||
@ -129,6 +149,10 @@ void testFloatsEqualBothNaN(void)
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -137,6 +161,8 @@ void testFloatsNotEqualInfNaN(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, 0.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -148,6 +174,8 @@ void testFloatsNotEqualNaNInf(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(0.0f / f_zero, 1.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -159,6 +187,8 @@ void testFloatsNotEqualActualInf(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(321.642f, 1.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(321.642f, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
@ -170,6 +200,8 @@ void testFloatsNotEqualExpectedInf(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, 321.642f);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 321.642f);
|
||||
VERIFY_FAILS_END
|
||||
@ -182,6 +214,10 @@ void testFloatsEqualBothInf(void)
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -190,12 +226,445 @@ void testFloatsNotEqualPlusMinusInf(void)
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_NOT_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, 2.0f);
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f, 1.0f);
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(-2.0f, -1.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterThanInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, 1.0f / f_zero);
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f / f_zero, 1.0f / f_zero);
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f / f_zero, 1.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(2.0f, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(0.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanInfActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f, -1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterThanBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_THAN_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, 2.0f);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(2.0f, 2.0f);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f, 1.0f);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-2.0f, -1.0f);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-2.0f, -2.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterOrEqualInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, 1.0f / f_zero);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f / f_zero, 1.0f / f_zero);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f / f_zero, 1.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(2.0f, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterOrEqualNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterOrEqualNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(0.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterOrEqualNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterOrEqualInfActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotGreaterOrEqualNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f, -1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterOrEqualBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsGreaterOrEqualBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsLessThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(2.0f, 1.0f);
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, -1.0f);
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(-1.0f, -2.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsLessThanInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f / f_zero, 1.0f);
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, -1.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, 2.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(0.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(-1.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessThanBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_THAN_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
void testFloatsLessOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(2.0f, 1.0f);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(2.0f, 2.0f);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, -1.0f);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-1.0f, -2.0f);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-2.0f, -2.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsLessOrEqualInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, -1.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessOrEqual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, 2.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessOrEqualNanActual(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, 0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessOrEqualNanThreshold(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(0.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsLessOrEqualNanBoth(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessOrEqualInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f, 1.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsNotLessOrEqualNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-1.0f / f_zero, 1.0f);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsLessOrEqualBothInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatsLessOrEqualBothNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_LESS_OR_EQUAL_FLOAT(-1.0f / f_zero, -1.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsPosInf1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
|
Reference in New Issue
Block a user