Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
95435afa
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,发现更多精彩内容 >>
提交
95435afa
编写于
9月 07, 2016
作者:
M
Mark VanderVoord
提交者:
GitHub
9月 07, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #214 from jsalling/feature/c-strings
Print escapes for C strings
上级
68a43b8f
de391861
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
3 deletion
+13
-3
src/unity.c
src/unity.c
+4
-2
test/tests/testunity.c
test/tests/testunity.c
+9
-1
未找到文件。
src/unity.c
浏览文件 @
95435afa
...
@@ -106,6 +106,7 @@ void UnityPrint(const char* string)
...
@@ -106,6 +106,7 @@ void UnityPrint(const char* string)
else
else
{
{
UNITY_OUTPUT_CHAR
(
'\\'
);
UNITY_OUTPUT_CHAR
(
'\\'
);
UNITY_OUTPUT_CHAR
(
'x'
);
UnityPrintNumberHex
((
_U_UINT
)
*
pch
,
2
);
UnityPrintNumberHex
((
_U_UINT
)
*
pch
,
2
);
}
}
pch
++
;
pch
++
;
...
@@ -143,6 +144,7 @@ void UnityPrintLen(const char* string, const _UU32 length)
...
@@ -143,6 +144,7 @@ void UnityPrintLen(const char* string, const _UU32 length)
else
else
{
{
UNITY_OUTPUT_CHAR
(
'\\'
);
UNITY_OUTPUT_CHAR
(
'\\'
);
UNITY_OUTPUT_CHAR
(
'x'
);
UnityPrintNumberHex
((
_U_UINT
)
*
pch
,
2
);
UnityPrintNumberHex
((
_U_UINT
)
*
pch
,
2
);
}
}
pch
++
;
pch
++
;
...
@@ -163,6 +165,8 @@ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T s
...
@@ -163,6 +165,8 @@ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T s
}
}
else
else
{
{
UNITY_OUTPUT_CHAR
(
'0'
);
UNITY_OUTPUT_CHAR
(
'x'
);
UnityPrintNumberHex
((
_U_UINT
)
number
,
(
char
)((
style
&
0x000F
)
<<
1
));
UnityPrintNumberHex
((
_U_UINT
)
number
,
(
char
)((
style
&
0x000F
)
<<
1
));
}
}
}
}
...
@@ -207,8 +211,6 @@ void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
...
@@ -207,8 +211,6 @@ void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
{
{
_U_UINT
nibble
;
_U_UINT
nibble
;
char
nibbles
=
nibbles_to_print
;
char
nibbles
=
nibbles_to_print
;
UNITY_OUTPUT_CHAR
(
'0'
);
UNITY_OUTPUT_CHAR
(
'x'
);
while
(
nibbles
>
0
)
while
(
nibbles
>
0
)
{
{
...
...
test/tests/testunity.c
浏览文件 @
95435afa
...
@@ -1381,7 +1381,7 @@ void testNotEqualString4(void)
...
@@ -1381,7 +1381,7 @@ void testNotEqualString4(void)
void
testNotEqualStringLen4
(
void
)
void
testNotEqualStringLen4
(
void
)
{
{
EXPECT_ABORT_BEGIN
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_STRING_LEN
(
"
\r\x16
"
,
"ba
r
\n
"
,
4
);
TEST_ASSERT_EQUAL_STRING_LEN
(
"
ba
\r\x16
"
,
"ba
\
r\n
"
,
4
);
VERIFY_FAILS_END
VERIFY_FAILS_END
}
}
...
@@ -2283,6 +2283,14 @@ void testFailureCountIncrementsAndIsReturnedAtEnd(void)
...
@@ -2283,6 +2283,14 @@ void testFailureCountIncrementsAndIsReturnedAtEnd(void)
TEST_ASSERT_EQUAL
(
1
,
failures
);
TEST_ASSERT_EQUAL
(
1
,
failures
);
}
}
void
testCstringsEscapeSequence
(
void
)
{
startPutcharSpy
();
UnityPrint
(
"
\x16\x10
"
);
endPutcharSpy
();
TEST_ASSERT_EQUAL_STRING
(
"
\\
x16
\\
x10"
,
getBufferPutcharSpy
());
}
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录