Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
64d98f24
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
大约 1 年 前同步成功
通知
34
Star
144
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Unity
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64d98f24
编写于
3月 02, 2016
作者:
M
Mark VanderVoord
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #177 from jsalling/refactor/unreachable
Fix unreachable code in Unity on fully covered switch statements
上级
e84a7c0a
13c99601
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
2 deletion
+34
-2
src/unity.c
src/unity.c
+6
-1
src/unity_internals.h
src/unity_internals.h
+2
-1
test/Makefile
test/Makefile
+3
-0
test/tests/testunity.c
test/tests/testunity.c
+23
-0
未找到文件。
src/unity.c
浏览文件 @
64d98f24
...
...
@@ -35,6 +35,7 @@ const char UnityStrInf[] = "Infinity";
const
char
UnityStrNegInf
[]
=
"Negative Infinity"
;
const
char
UnityStrNaN
[]
=
"NaN"
;
const
char
UnityStrDet
[]
=
"Determinate"
;
const
char
UnityStrInvalidFloatTrait
[]
=
"Invalid Float Trait"
;
const
char
UnityStrErrFloat
[]
=
"Unity Floating Point Disabled"
;
const
char
UnityStrErrDouble
[]
=
"Unity Double Precision Disabled"
;
const
char
UnityStrErr64
[]
=
"Unity 64-bit Support Disabled"
;
...
...
@@ -775,6 +776,8 @@ void UnityAssertFloatSpecial(const _UF actual,
break
;
default:
trait_index
=
0
;
trait_names
[
0
]
=
UnityStrInvalidFloatTrait
;
break
;
}
...
...
@@ -905,7 +908,7 @@ void UnityAssertDoubleSpecial(const _UD actual,
const
char
*
trait_names
[]
=
{
UnityStrInf
,
UnityStrNegInf
,
UnityStrNaN
,
UnityStrDet
};
_U_SINT
should_be_trait
=
((
_U_SINT
)
style
&
1
);
_U_SINT
is_trait
=
!
should_be_trait
;
_U_SINT
trait_index
=
style
>>
1
;
_U_SINT
trait_index
=
(
_U_SINT
)(
style
>>
1
)
;
UNITY_SKIP_EXECUTION
;
...
...
@@ -938,6 +941,8 @@ void UnityAssertDoubleSpecial(const _UD actual,
break
;
default:
trait_index
=
0
;
trait_names
[
0
]
=
UnityStrInvalidFloatTrait
;
break
;
}
...
...
src/unity_internals.h
浏览文件 @
64d98f24
...
...
@@ -396,7 +396,8 @@ typedef enum _UNITY_FLOAT_TRAIT_T
UNITY_FLOAT_IS_NOT_NAN
,
UNITY_FLOAT_IS_NAN
,
UNITY_FLOAT_IS_NOT_DET
,
UNITY_FLOAT_IS_DET
UNITY_FLOAT_IS_DET
,
UNITY_FLOAT_INVALID_TRAIT
}
UNITY_FLOAT_TRAIT_T
;
#endif
...
...
test/Makefile
浏览文件 @
64d98f24
...
...
@@ -28,6 +28,9 @@ coverage: $(BUILD_DIR)/testunityRunner.c
uncovered
:
grep
'###'
$(BUILD_DIR)
/unity.c.gcov
-C2
||
true
test
:
CFLAGS += -Wbad-function-cast -Wcast-qual -Wconversion -Wformat=2 -Wold-style-definition
\
-Wpointer-arith -Wshadow -Wstrict-overflow=5 -Wstrict-prototypes -Wswitch-default -Wundef
\
-Wunreachable-code -Wunused -fstrict-aliasing
test
:
$(BUILD_DIR)/testunityRunner.c
$(CC)
$(CFLAGS)
$(DEFINES)
$(INC_DIR)
$(SRC)
-o
$(TARGET)
./
$(TARGET)
...
...
test/tests/testunity.c
浏览文件 @
64d98f24
...
...
@@ -2978,6 +2978,18 @@ void testFloatIsNotDeterminate2(void)
#endif
}
void
testFloatTraitFailsOnInvalidTrait
(
void
)
{
#ifdef UNITY_EXCLUDE_FLOAT
TEST_IGNORE
();
#else
EXPECT_ABORT_BEGIN
UnityAssertFloatSpecial
(
1
.
0
f
,
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录