mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-24 08:51:36 +01:00
- rework to not bother with any of the ever-changing test frameworks in Ruby (sigh) for self-testing
- started working on cleaner floating point support. more coming.
This commit is contained in:
@@ -9,7 +9,10 @@
|
||||
|
||||
// Dividing by these constants produces +/- infinity.
|
||||
// The rationale is given in UnityAssertFloatIsInf's body.
|
||||
#ifndef UNITY_EXCLUDE_FLOAT
|
||||
static const _UF f_zero = 0.0f;
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||
static const _UD d_zero = 0.0;
|
||||
#endif
|
||||
@@ -2332,17 +2335,47 @@ void testFloatsNotEqualPlusMinusInf(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsInf(void)
|
||||
void testFloatIsPosInf1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_FLOAT_IS_INF(2.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsPosInf2(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNegInf1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_FLOAT_IS_NEG_INF(-3.0f / f_zero);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotInf(void)
|
||||
void testFloatIsNegInf2(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(-3.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotPosInf1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
@@ -2353,6 +2386,15 @@ void testFloatIsNotInf(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotPosInf2(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotNegInf(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
@@ -2364,7 +2406,7 @@ void testFloatIsNotNegInf(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNan(void)
|
||||
void testFloatIsNan1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
@@ -2373,7 +2415,18 @@ void testFloatIsNan(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotNan(void)
|
||||
void testFloatIsNan2(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_FLOAT_IS_NOT_NAN(0.0f / f_zero);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotNan1(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
@@ -2384,6 +2437,15 @@ void testFloatIsNotNan(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatIsNotNan2(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
TEST_ASSERT_FLOAT_IS_NOT_NAN(234.9f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatInfIsNotNan(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
|
||||
Reference in New Issue
Block a user