mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-27 18:24:27 +01:00
Add a value to FLOAT_TRAIT enum to enforce use of default case in switches
Revert the previous commit. Add tests for extended enum cases. Fix crash due to accessing 'trait_names' array out of bounds. Adding an extra invalid value to the end of an enum causes '-Wswitch' flag to warn unless there is a switch default case - also enabled by '-Wall'.
This commit is contained in:
@@ -2978,6 +2978,18 @@ void testFloatIsNotDeterminate2(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testFloatTraitFailsOnInvalidTrait(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
UnityAssertFloatSpecial(1.0f, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void testEqualFloatArrays(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
@@ -3483,6 +3495,17 @@ void testDoubleIsNotDeterminate2(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDoubleTraitFailsOnInvalidTrait(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
TEST_IGNORE();
|
||||
#else
|
||||
EXPECT_ABORT_BEGIN
|
||||
UnityAssertDoubleSpecial(1.0, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT);
|
||||
VERIFY_FAILS_END
|
||||
#endif
|
||||
}
|
||||
|
||||
void testEqualDoubleArrays(void)
|
||||
{
|
||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||
|
||||
Reference in New Issue
Block a user