Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
50ce8a88
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,发现更多精彩内容 >>
未验证
提交
50ce8a88
编写于
10月 31, 2018
作者:
K
Kochise
提交者:
GitHub
10月 31, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some cleanup
上级
96127581
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
77 addition
and
7 deletion
+77
-7
src/unity.c
src/unity.c
+77
-7
未找到文件。
src/unity.c
浏览文件 @
50ce8a88
...
...
@@ -214,7 +214,9 @@ void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
int
nibble
;
char
nibbles
=
nibbles_to_print
;
if
((
unsigned
)
nibbles
>
(
2
*
sizeof
(
number
)))
{
nibbles
=
2
*
sizeof
(
number
);
}
while
(
nibbles
>
0
)
{
...
...
@@ -277,9 +279,18 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
}
/* handle zero, NaN, and +/- infinity */
if
(
number
==
0
.
0
f
)
UnityPrint
(
"0"
);
else
if
(
isnan
(
number
))
UnityPrint
(
"nan"
);
else
if
(
isinf
(
number
))
UnityPrint
(
"inf"
);
if
(
number
==
0
.
0
f
)
{
UnityPrint
(
"0"
);
}
else
if
(
isnan
(
number
))
{
UnityPrint
(
"nan"
);
}
else
if
(
isinf
(
number
))
{
UnityPrint
(
"inf"
);
}
else
{
int
exponent
=
0
;
...
...
@@ -621,9 +632,15 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
UnityPrintPointlessAndBail
();
}
if
(
expected
==
actual
)
return
;
/* Both are NULL or same pointer */
if
(
expected
==
actual
)
{
return
;
/* Both are NULL or same pointer */
}
if
(
UnityIsOneArrayNull
(
expected
,
actual
,
lineNumber
,
msg
))
{
UNITY_FAIL_AND_BAIL
;
}
while
((
elements
>
0
)
&&
elements
--
)
{
...
...
@@ -734,9 +751,15 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
UnityPrintPointlessAndBail
();
}
if
(
expected
==
actual
)
return
;
/* Both are NULL or same pointer */
if
(
expected
==
actual
)
{
return
;
/* Both are NULL or same pointer */
}
if
(
UnityIsOneArrayNull
((
UNITY_INTERNAL_PTR
)
expected
,
(
UNITY_INTERNAL_PTR
)
actual
,
lineNumber
,
msg
))
{
UNITY_FAIL_AND_BAIL
;
}
while
(
elements
--
)
{
...
...
@@ -821,14 +844,18 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
UnityTestResultsFailBegin
(
lineNumber
);
UnityPrint
(
UnityStrExpected
);
if
(
!
should_be_trait
)
{
UnityPrint
(
UnityStrNot
);
}
UnityPrint
(
trait_names
[
trait_index
]);
UnityPrint
(
UnityStrWas
);
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
UnityPrintFloat
((
UNITY_DOUBLE
)
actual
);
#else
if
(
should_be_trait
)
{
UnityPrint
(
UnityStrNot
);
}
UnityPrint
(
trait_names
[
trait_index
]);
#endif
UnityAddMsgIfSpecified
(
msg
);
...
...
@@ -865,9 +892,15 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expecte
UnityPrintPointlessAndBail
();
}
if
(
expected
==
actual
)
return
;
/* Both are NULL or same pointer */
if
(
expected
==
actual
)
{
return
;
/* Both are NULL or same pointer */
}
if
(
UnityIsOneArrayNull
((
UNITY_INTERNAL_PTR
)
expected
,
(
UNITY_INTERNAL_PTR
)
actual
,
lineNumber
,
msg
))
{
UNITY_FAIL_AND_BAIL
;
}
while
(
elements
--
)
{
...
...
@@ -951,14 +984,18 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
UnityTestResultsFailBegin
(
lineNumber
);
UnityPrint
(
UnityStrExpected
);
if
(
!
should_be_trait
)
{
UnityPrint
(
UnityStrNot
);
}
UnityPrint
(
trait_names
[
trait_index
]);
UnityPrint
(
UnityStrWas
);
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
UnityPrintFloat
(
actual
);
#else
if
(
should_be_trait
)
{
UnityPrint
(
UnityStrNot
);
}
UnityPrint
(
trait_names
[
trait_index
]);
#endif
UnityAddMsgIfSpecified
(
msg
);
...
...
@@ -981,16 +1018,24 @@ void UnityAssertNumbersWithin(const UNITY_UINT delta,
if
((
style
&
UNITY_DISPLAY_RANGE_INT
)
==
UNITY_DISPLAY_RANGE_INT
)
{
if
(
actual
>
expected
)
{
Unity
.
CurrentTestFailed
=
(
UNITY_UINT
)((
UNITY_UINT
)(
actual
-
expected
)
>
delta
);
}
else
{
Unity
.
CurrentTestFailed
=
(
UNITY_UINT
)((
UNITY_UINT
)(
expected
-
actual
)
>
delta
);
}
}
else
{
if
((
UNITY_UINT
)
actual
>
(
UNITY_UINT
)
expected
)
{
Unity
.
CurrentTestFailed
=
(
UNITY_UINT
)((
UNITY_UINT
)(
actual
-
expected
)
>
delta
);
}
else
{
Unity
.
CurrentTestFailed
=
(
UNITY_UINT
)((
UNITY_UINT
)(
expected
-
actual
)
>
delta
);
}
}
if
(
Unity
.
CurrentTestFailed
)
...
...
@@ -1186,9 +1231,15 @@ void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
UnityPrintPointlessAndBail
();
}
if
(
expected
==
actual
)
return
;
/* Both are NULL or same pointer */
if
(
expected
==
actual
)
{
return
;
/* Both are NULL or same pointer */
}
if
(
UnityIsOneArrayNull
(
expected
,
actual
,
lineNumber
,
msg
))
{
UNITY_FAIL_AND_BAIL
;
}
while
(
elements
--
)
{
...
...
@@ -1428,9 +1479,13 @@ int UnityParseOptions(int argc, char** argv)
case
'n'
:
/* include tests with name including this string */
case
'f'
:
/* an alias for -n */
if
(
argv
[
i
][
2
]
==
'='
)
{
UnityOptionIncludeNamed
=
&
argv
[
i
][
3
];
}
else
if
(
++
i
<
argc
)
{
UnityOptionIncludeNamed
=
argv
[
i
];
}
else
{
UnityPrint
(
"ERROR: No Test String to Include Matches For"
);
...
...
@@ -1446,9 +1501,13 @@ int UnityParseOptions(int argc, char** argv)
break
;
case
'x'
:
/* exclude tests with name including this string */
if
(
argv
[
i
][
2
]
==
'='
)
{
UnityOptionExcludeNamed
=
&
argv
[
i
][
3
];
}
else
if
(
++
i
<
argc
)
{
UnityOptionExcludeNamed
=
argv
[
i
];
}
else
{
UnityPrint
(
"ERROR: No Test String to Exclude Matches For"
);
...
...
@@ -1476,7 +1535,9 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
const
char
*
lnext
=
lptr
;
if
(
*
sptr
==
'*'
)
{
return
1
;
}
while
(
*
lptr
)
{
...
...
@@ -1524,7 +1585,9 @@ int UnityStringArgumentMatches(const char* str)
while
(
ptr1
[
0
]
!=
0
)
{
if
((
ptr1
[
0
]
==
'"'
)
||
(
ptr1
[
0
]
==
'\''
))
{
ptr1
++
;
}
/* look for the start of the next partial */
ptr2
=
ptr1
;
...
...
@@ -1533,7 +1596,9 @@ int UnityStringArgumentMatches(const char* str)
{
ptr2
++
;
if
((
ptr2
[
0
]
==
':'
)
&&
(
ptr2
[
1
]
!=
0
)
&&
(
ptr2
[
0
]
!=
'\''
)
&&
(
ptr2
[
0
]
!=
'"'
)
&&
(
ptr2
[
0
]
!=
','
))
{
ptrf
=
&
ptr2
[
1
];
}
}
while
((
ptr2
[
0
]
!=
0
)
&&
(
ptr2
[
0
]
!=
'\''
)
&&
(
ptr2
[
0
]
!=
'"'
)
&&
(
ptr2
[
0
]
!=
','
));
while
((
ptr2
[
0
]
!=
0
)
&&
((
ptr2
[
0
]
==
':'
)
||
(
ptr2
[
0
]
==
'\''
)
||
(
ptr2
[
0
]
==
'"'
)
||
(
ptr2
[
0
]
==
','
)))
...
...
@@ -1580,14 +1645,19 @@ int UnityTestMatches(void)
retval
=
UnityStringArgumentMatches
(
UnityOptionIncludeNamed
);
}
else
{
retval
=
1
;
}
/* Check if this test name matches the excluded test pattern */
if
(
UnityOptionExcludeNamed
)
{
if
(
UnityStringArgumentMatches
(
UnityOptionExcludeNamed
))
{
retval
=
0
;
}
}
return
retval
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录