Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party CJSON
提交
acf80470
T
Third Party CJSON
项目概览
OpenHarmony
/
Third Party CJSON
大约 1 年 前同步成功
通知
6
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party CJSON
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
acf80470
编写于
9月 12, 2017
作者:
M
Max Bruckner
浏览文件
操作
浏览文件
下载
差异文件
Update Unity to version v2.4.2
Merge commit '
b7bfe1e9
' into develop
上级
469a437e
b7bfe1e9
变更
16
展开全部
显示空白变更内容
内联
并排
Showing
16 changed file
with
825 addition
and
264 deletion
+825
-264
tests/unity/README.md
tests/unity/README.md
+11
-0
tests/unity/auto/generate_module.rb
tests/unity/auto/generate_module.rb
+3
-3
tests/unity/auto/generate_test_runner.rb
tests/unity/auto/generate_test_runner.rb
+1
-1
tests/unity/auto/stylize_as_junit.rb
tests/unity/auto/stylize_as_junit.rb
+0
-0
tests/unity/docs/UnityAssertionsReference.md
tests/unity/docs/UnityAssertionsReference.md
+54
-0
tests/unity/examples/unity_config.h
tests/unity/examples/unity_config.h
+6
-4
tests/unity/extras/fixture/rakefile_helper.rb
tests/unity/extras/fixture/rakefile_helper.rb
+1
-1
tests/unity/extras/fixture/test/Makefile
tests/unity/extras/fixture/test/Makefile
+1
-0
tests/unity/release/build.info
tests/unity/release/build.info
+1
-1
tests/unity/release/version.info
tests/unity/release/version.info
+1
-1
tests/unity/src/unity.c
tests/unity/src/unity.c
+129
-81
tests/unity/src/unity.h
tests/unity/src/unity.h
+60
-0
tests/unity/src/unity_internals.h
tests/unity/src/unity_internals.h
+47
-7
tests/unity/test/Makefile
tests/unity/test/Makefile
+1
-0
tests/unity/test/rakefile_helper.rb
tests/unity/test/rakefile_helper.rb
+1
-1
tests/unity/test/tests/testunity.c
tests/unity/test/tests/testunity.c
+508
-164
未找到文件。
tests/unity/README.md
浏览文件 @
acf80470
...
@@ -118,6 +118,17 @@ Another way of calling TEST_ASSERT_EQUAL_INT
...
@@ -118,6 +118,17 @@ Another way of calling TEST_ASSERT_EQUAL_INT
Asserts that the actual value is within plus or minus delta of the expected value. This also comes in
Asserts that the actual value is within plus or minus delta of the expected value. This also comes in
size specific variants.
size specific variants.
TEST_ASSERT_GREATER_THAN(threshold, actual)
Asserts that the actual value is greater than the threshold. This also comes in size specific variants.
TEST_ASSERT_LESS_THAN(threshold, actual)
Asserts that the actual value is less than the threshold. This also comes in size specific variants.
Arrays
Arrays
------
------
...
...
tests/unity/auto/generate_module.rb
浏览文件 @
acf80470
...
@@ -172,7 +172,7 @@ class UnityModuleGenerator
...
@@ -172,7 +172,7 @@ class UnityModuleGenerator
when
'camel'
then
part1
when
'camel'
then
part1
when
'snake'
then
part1
.
downcase
when
'snake'
then
part1
.
downcase
when
'caps'
then
part1
.
upcase
when
'caps'
then
part1
.
upcase
else
part1
.
downcase
else
part1
end
end
else
else
case
(
@options
[
:naming
])
case
(
@options
[
:naming
])
...
@@ -180,7 +180,7 @@ class UnityModuleGenerator
...
@@ -180,7 +180,7 @@ class UnityModuleGenerator
when
'camel'
then
part1
+
part2
when
'camel'
then
part1
+
part2
when
'snake'
then
part1
.
downcase
+
'_'
+
part2
.
downcase
when
'snake'
then
part1
.
downcase
+
'_'
+
part2
.
downcase
when
'caps'
then
part1
.
upcase
+
'_'
+
part2
.
upcase
when
'caps'
then
part1
.
upcase
+
'_'
+
part2
.
upcase
else
part1
.
downcase
+
'_'
+
part2
.
downcase
else
part1
+
'_'
+
part2
end
end
end
end
end
end
...
@@ -290,7 +290,7 @@ if $0 == __FILE__
...
@@ -290,7 +290,7 @@ if $0 == __FILE__
' -n"camel" sets the file naming convention.'
,
' -n"camel" sets the file naming convention.'
,
' bumpy - BumpyCaseFilenames.'
,
' bumpy - BumpyCaseFilenames.'
,
' camel - camelCaseFilenames.'
,
' camel - camelCaseFilenames.'
,
' snake - snake_case_filenames.
(DEFAULT)
'
,
' snake - snake_case_filenames.'
,
' caps - CAPS_CASE_FILENAMES.'
,
' caps - CAPS_CASE_FILENAMES.'
,
' -u update subversion too (requires subversion command line)'
,
' -u update subversion too (requires subversion command line)'
,
' -y"my.yml" selects a different yaml config file for module generation'
,
' -y"my.yml" selects a different yaml config file for module generation'
,
...
...
tests/unity/auto/generate_test_runner.rb
浏览文件 @
acf80470
...
@@ -119,7 +119,7 @@ class UnityTestRunnerGenerator
...
@@ -119,7 +119,7 @@ class UnityTestRunnerGenerator
source_index
=
0
source_index
=
0
tests_and_line_numbers
.
size
.
times
do
|
i
|
tests_and_line_numbers
.
size
.
times
do
|
i
|
source_lines
[
source_index
..-
1
].
each_with_index
do
|
line
,
index
|
source_lines
[
source_index
..-
1
].
each_with_index
do
|
line
,
index
|
next
unless
line
=~
/
#{
tests_and_line_numbers
[
i
][
:test
]
}
/
next
unless
line
=~
/
\s+
#{
tests_and_line_numbers
[
i
][
:test
]
}
(?:\s|\()
/
source_index
+=
index
source_index
+=
index
tests_and_line_numbers
[
i
][
:line_number
]
=
source_index
+
1
tests_and_line_numbers
[
i
][
:line_number
]
=
source_index
+
1
break
break
...
...
tests/unity/auto/stylize_as_junit.rb
100644 → 100755
浏览文件 @
acf80470
文件模式从 100644 更改为 100755
tests/unity/docs/UnityAssertionsReference.md
浏览文件 @
acf80470
...
@@ -290,6 +290,60 @@ Asserts the specified bit of the `actual` parameter is high.
...
@@ -290,6 +290,60 @@ Asserts the specified bit of the `actual` parameter is high.
Asserts the specified bit of the
`actual`
parameter is low.
Asserts the specified bit of the
`actual`
parameter is low.
### Integer Less Than / Greater Than
These assertions verify that the
`actual`
parameter is less than or greater
than
`threshold`
(exclusive). For example, if the threshold value is 0 for the
greater than assertion will fail if it is 0 or less.
##### `TEST_ASSERT_GREATER_THAN (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_INT (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_INT8 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_INT16 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_INT32 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_UINT (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_UINT8 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_UINT16 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_UINT32 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_HEX8 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_HEX16 (threshold, actual)`
##### `TEST_ASSERT_GREATER_THAN_HEX32 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_INT (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_INT8 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_INT16 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_INT32 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_UINT (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_UINT8 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_UINT16 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_UINT32 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_HEX8 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_HEX16 (threshold, actual)`
##### `TEST_ASSERT_LESS_THAN_HEX32 (threshold, actual)`
### Integer Ranges (of all sizes)
### Integer Ranges (of all sizes)
...
...
tests/unity/examples/unity_config.h
浏览文件 @
acf80470
...
@@ -202,7 +202,9 @@
...
@@ -202,7 +202,9 @@
* serial `RS232_putc()` function you wrote like thus:
* serial `RS232_putc()` function you wrote like thus:
*/
*/
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
/* #define UNITY_OUTPUT_CHAR_HEADER_DECLARATION RS232_putc(int) */
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
/* #define UNITY_OUTPUT_FLUSH_HEADER_DECLARATION RS232_flush(void) */
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
...
...
tests/unity/extras/fixture/rakefile_helper.rb
浏览文件 @
acf80470
...
@@ -53,7 +53,7 @@ module RakefileHelpers
...
@@ -53,7 +53,7 @@ module RakefileHelpers
defines
=
if
$cfg
[
'compiler'
][
'defines'
][
'items'
].
nil?
defines
=
if
$cfg
[
'compiler'
][
'defines'
][
'items'
].
nil?
''
''
else
else
squash
(
$cfg
[
'compiler'
][
'defines'
][
'prefix'
],
$cfg
[
'compiler'
][
'defines'
][
'items'
]
+
[
'UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'
])
squash
(
$cfg
[
'compiler'
][
'defines'
][
'prefix'
],
$cfg
[
'compiler'
][
'defines'
][
'items'
]
+
[
'UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'
]
+
[
'UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\)'
]
)
end
end
options
=
squash
(
''
,
$cfg
[
'compiler'
][
'options'
])
options
=
squash
(
''
,
$cfg
[
'compiler'
][
'options'
])
includes
=
squash
(
$cfg
[
'compiler'
][
'includes'
][
'prefix'
],
$cfg
[
'compiler'
][
'includes'
][
'items'
])
includes
=
squash
(
$cfg
[
'compiler'
][
'includes'
][
'prefix'
],
$cfg
[
'compiler'
][
'includes'
][
'items'
])
...
...
tests/unity/extras/fixture/test/Makefile
浏览文件 @
acf80470
...
@@ -6,6 +6,7 @@ endif
...
@@ -6,6 +6,7 @@ endif
CFLAGS
+=
-std
=
c99
-pedantic
-Wall
-Wextra
-Werror
CFLAGS
+=
-std
=
c99
-pedantic
-Wall
-Wextra
-Werror
CFLAGS
+=
$(DEBUG)
CFLAGS
+=
$(DEBUG)
DEFINES
=
-D
UNITY_OUTPUT_CHAR
=
UnityOutputCharSpy_OutputChar
DEFINES
=
-D
UNITY_OUTPUT_CHAR
=
UnityOutputCharSpy_OutputChar
DEFINES
+=
-D
UNITY_OUTPUT_CHAR_HEADER_DECLARATION
=
UnityOutputCharSpy_OutputChar
\(
int
\)
SRC
=
../src/unity_fixture.c
\
SRC
=
../src/unity_fixture.c
\
../../../src/unity.c
\
../../../src/unity.c
\
unity_fixture_Test.c
\
unity_fixture_Test.c
\
...
...
tests/unity/release/build.info
浏览文件 @
acf80470
12
0
12
1
tests/unity/release/version.info
浏览文件 @
acf80470
2.4.
1
2.4.
2
tests/unity/src/unity.c
浏览文件 @
acf80470
...
@@ -27,6 +27,8 @@ static const char UnityStrNull[] = "NULL";
...
@@ -27,6 +27,8 @@ static const char UnityStrNull[] = "NULL";
static
const
char
UnityStrSpacer
[]
=
". "
;
static
const
char
UnityStrSpacer
[]
=
". "
;
static
const
char
UnityStrExpected
[]
=
" Expected "
;
static
const
char
UnityStrExpected
[]
=
" Expected "
;
static
const
char
UnityStrWas
[]
=
" Was "
;
static
const
char
UnityStrWas
[]
=
" Was "
;
static
const
char
UnityStrGt
[]
=
" to be greater than "
;
static
const
char
UnityStrLt
[]
=
" to be less than "
;
static
const
char
UnityStrElement
[]
=
" Element "
;
static
const
char
UnityStrElement
[]
=
" Element "
;
static
const
char
UnityStrByte
[]
=
" Byte "
;
static
const
char
UnityStrByte
[]
=
" Byte "
;
static
const
char
UnityStrMemory
[]
=
" Memory Mismatch."
;
static
const
char
UnityStrMemory
[]
=
" Memory Mismatch."
;
...
@@ -235,95 +237,97 @@ void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
...
@@ -235,95 +237,97 @@ void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
/*-----------------------------------------------*/
/*-----------------------------------------------*/
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
static
void
UnityPrintDecimalAndNumberWithLeadingZeros
(
UNITY_INT32
fraction_part
,
UNITY_INT32
divisor
)
/* This function prints a floating-point value in a format similar to
{
* printf("%.6g"). It can work with either single- or double-precision,
UNITY_OUTPUT_CHAR
(
'.'
);
* but for simplicity, it prints only 6 significant digits in either case.
while
(
divisor
>
0
)
* Printing more than 6 digits accurately is hard (at least in the single-
{
* precision case) and isn't attempted here. */
UNITY_OUTPUT_CHAR
(
'0'
+
fraction_part
/
divisor
);
fraction_part
%=
divisor
;
divisor
/=
10
;
if
(
fraction_part
==
0
)
break
;
/* Truncate trailing 0's */
}
}
#ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
/* If rounds up && remainder 0.5 && result odd && below cutoff for double precision issues */
#define ROUND_TIES_TO_EVEN(orig, num_int, num) \
if (num_int > (num) && (num) - (num_int-1) <= 0.5 && (num_int & 1) == 1 && orig < 1e22) \
num_int -= 1
/* => a tie to round down to even */
#else
#define ROUND_TIES_TO_EVEN(orig, num_int, num)
/* Remove macro */
#endif
/* Printing floating point numbers is hard. Some goals of this implementation: works for embedded
* systems, floats or doubles, and has a reasonable format. The key paper in this area,
* 'How to Print Floating-Point Numbers Accurately' by Steele & White, shows an approximation by
* scaling called Dragon 2. This code uses a similar idea. The other core algorithm uses casts and
* floating subtraction to give exact remainders after the decimal, to be scaled into an integer.
* Extra trailing 0's are excluded. The output defaults to rounding to nearest, ties to even. You
* can enable rounding ties away from zero. Note: UNITY_DOUBLE param can typedef to float or double
* The old version required compiling in snprintf. For reference, with a similar format as now:
* char buf[19];
* if (number > 4294967296.0 || -number > 4294967296.0) snprintf(buf, sizeof buf, "%.8e", number);
* else snprintf(buf, sizeof buf, "%.6f", number);
* UnityPrint(buf);
*/
void
UnityPrintFloat
(
const
UNITY_DOUBLE
input_number
)
void
UnityPrintFloat
(
const
UNITY_DOUBLE
input_number
)
{
{
UNITY_DOUBLE
number
;
UNITY_DOUBLE
number
=
input_number
;
if
(
input_number
<
0
)
/* print minus sign (including for negative zero) */
if
(
number
<
0
.
0
f
||
(
number
==
0
.
0
f
&&
1
.
0
f
/
number
<
0
.
0
f
))
{
{
UNITY_OUTPUT_CHAR
(
'-'
);
UNITY_OUTPUT_CHAR
(
'-'
);
number
=
-
input_number
;
number
=
-
number
;
}
else
{
number
=
input_number
;
}
}
if
(
isnan
(
number
))
UnityPrint
(
UnityStrNaN
);
/* handle zero, NaN, and +/- infinity */
else
if
(
isinf
(
number
))
UnityPrintLen
(
UnityStrInf
,
3
);
if
(
number
==
0
.
0
f
)
UnityPrint
(
"0"
);
else
if
(
number
<=
0
.
0000005
&&
number
>
0
)
UnityPrint
(
"0.000000..."
);
/* Small number */
else
if
(
isnan
(
number
))
UnityPrint
(
"nan"
);
else
if
(
number
<
4294967295
.
9999995
)
/* Rounded result fits in 32 bits, "%.6f" format */
else
if
(
isinf
(
number
))
UnityPrint
(
"inf"
);
else
{
{
const
UNITY_INT32
divisor
=
1000000
/
10
;
int
exponent
=
0
;
UNITY_UINT32
integer_part
=
(
UNITY_UINT32
)
number
;
int
decimals
,
digits
;
UNITY_INT32
fraction_part
=
(
UNITY_INT32
)((
number
-
(
UNITY_DOUBLE
)
integer_part
)
*
1000000
.
0
+
0
.
5
);
UNITY_INT32
n
;
/* Double precision calculation gives best performance for six rounded decimal places */
char
buf
[
16
];
ROUND_TIES_TO_EVEN
(
number
,
fraction_part
,
(
number
-
(
UNITY_DOUBLE
)
integer_part
)
*
1000000
.
0
);
/* scale up or down by powers of 10 */
while
(
number
<
100000
.
0
f
/
1e6
f
)
{
number
*=
1e6
f
;
exponent
-=
6
;
}
while
(
number
<
100000
.
0
f
)
{
number
*=
10
.
0
f
;
exponent
--
;
}
while
(
number
>
1000000
.
0
f
*
1e6
f
)
{
number
/=
1e6
f
;
exponent
+=
6
;
}
while
(
number
>
1000000
.
0
f
)
{
number
/=
10
.
0
f
;
exponent
++
;
}
if
(
fraction_part
==
1000000
)
/* Carry across the decimal point */
/* round to nearest integer */
n
=
((
UNITY_INT32
)(
number
+
number
)
+
1
)
/
2
;
if
(
n
>
999999
)
{
{
fraction_part
=
0
;
n
=
10000
0
;
integer_part
+=
1
;
exponent
++
;
}
}
UnityPrintNumberUnsigned
(
integer_part
);
/* determine where to place decimal point */
UnityPrintDecimalAndNumberWithLeadingZeros
(
fraction_part
,
divisor
);
decimals
=
(
exponent
<=
0
&&
exponent
>=
-
9
)
?
-
exponent
:
5
;
}
exponent
+=
decimals
;
else
/* Number is larger, use exponential format of 9 digits, "%.8e" */
/* truncate trailing zeroes after decimal point */
while
(
decimals
>
0
&&
n
%
10
==
0
)
{
{
const
UNITY_INT32
divisor
=
1000000000
/
10
;
n
/=
10
;
UNITY_INT32
integer_part
;
decimals
--
;
UNITY_DOUBLE_TYPE
divide
=
10
.
0
;
}
int
exponent
=
9
;
while
(
number
/
divide
>=
1000000000
.
0
-
0
.
5
)
/* build up buffer in reverse order */
digits
=
0
;
while
(
n
!=
0
||
digits
<
decimals
+
1
)
{
{
divide
*=
10
;
buf
[
digits
++
]
=
(
char
)(
'0'
+
n
%
10
);
exponent
++
;
n
/=
10
;
}
while
(
digits
>
0
)
{
if
(
digits
==
decimals
)
UNITY_OUTPUT_CHAR
(
'.'
);
UNITY_OUTPUT_CHAR
(
buf
[
--
digits
]);
}
}
integer_part
=
(
UNITY_INT32
)(
number
/
divide
+
0
.
5
);
/* Double precision calculation required for float, to produce 9 rounded digits */
ROUND_TIES_TO_EVEN
(
number
,
integer_part
,
number
/
divide
);
UNITY_OUTPUT_CHAR
(
'0'
+
integer_part
/
divisor
);
/* print exponent if needed */
UnityPrintDecimalAndNumberWithLeadingZeros
(
integer_part
%
divisor
,
divisor
/
10
);
if
(
exponent
!=
0
)
{
UNITY_OUTPUT_CHAR
(
'e'
);
UNITY_OUTPUT_CHAR
(
'e'
);
if
(
exponent
<
0
)
{
UNITY_OUTPUT_CHAR
(
'-'
);
exponent
=
-
exponent
;
}
else
{
UNITY_OUTPUT_CHAR
(
'+'
);
UNITY_OUTPUT_CHAR
(
'+'
);
if
(
exponent
<
10
)
UNITY_OUTPUT_CHAR
(
'0'
);
}
UnityPrintNumber
(
exponent
);
digits
=
0
;
while
(
exponent
!=
0
||
digits
<
2
)
{
buf
[
digits
++
]
=
(
char
)(
'0'
+
exponent
%
10
);
exponent
/=
10
;
}
while
(
digits
>
0
)
{
UNITY_OUTPUT_CHAR
(
buf
[
--
digits
]);
}
}
}
}
}
}
#endif
/* ! UNITY_EXCLUDE_FLOAT_PRINT */
#endif
/* ! UNITY_EXCLUDE_FLOAT_PRINT */
...
@@ -526,6 +530,50 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
...
@@ -526,6 +530,50 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
}
}
}
}
/*-----------------------------------------------*/
void
UnityAssertGreaterNumber
(
const
UNITY_INT
threshold
,
const
UNITY_INT
actual
,
const
char
*
msg
,
const
UNITY_LINE_TYPE
lineNumber
,
const
UNITY_DISPLAY_STYLE_T
style
)
{
RETURN_IF_FAIL_OR_IGNORE
;
if
(
!
(
actual
>
threshold
))
{
UnityTestResultsFailBegin
(
lineNumber
);
UnityPrint
(
UnityStrExpected
);
UnityPrintNumberByStyle
(
actual
,
style
);
UnityPrint
(
UnityStrGt
);
UnityPrintNumberByStyle
(
threshold
,
style
);
UnityAddMsgIfSpecified
(
msg
);
UNITY_FAIL_AND_BAIL
;
}
}
/*-----------------------------------------------*/
void
UnityAssertSmallerNumber
(
const
UNITY_INT
threshold
,
const
UNITY_INT
actual
,
const
char
*
msg
,
const
UNITY_LINE_TYPE
lineNumber
,
const
UNITY_DISPLAY_STYLE_T
style
)
{
RETURN_IF_FAIL_OR_IGNORE
;
if
(
!
(
actual
<
threshold
))
{
UnityTestResultsFailBegin
(
lineNumber
);
UnityPrint
(
UnityStrExpected
);
UnityPrintNumberByStyle
(
actual
,
style
);
UnityPrint
(
UnityStrLt
);
UnityPrintNumberByStyle
(
threshold
,
style
);
UnityAddMsgIfSpecified
(
msg
);
UNITY_FAIL_AND_BAIL
;
}
}
#define UnityPrintPointlessAndBail() \
#define UnityPrintPointlessAndBail() \
{ \
{ \
UnityTestResultsFailBegin(lineNumber); \
UnityTestResultsFailBegin(lineNumber); \
...
@@ -1025,7 +1073,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
...
@@ -1025,7 +1073,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
{
{
UNITY_UINT32
i
=
0
;
UNITY_UINT32
i
=
0
;
UNITY_UINT32
j
=
0
;
UNITY_UINT32
j
=
0
;
const
char
*
exp
=
NULL
;
const
char
*
exp
d
=
NULL
;
const
char
*
act
=
NULL
;
const
char
*
act
=
NULL
;
RETURN_IF_FAIL_OR_IGNORE
;
RETURN_IF_FAIL_OR_IGNORE
;
...
@@ -1048,7 +1096,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
...
@@ -1048,7 +1096,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
if
(
flags
!=
UNITY_ARRAY_TO_ARRAY
)
if
(
flags
!=
UNITY_ARRAY_TO_ARRAY
)
{
{
exp
=
(
const
char
*
)
expected
;
exp
d
=
(
const
char
*
)
expected
;
}
}
do
do
...
@@ -1056,15 +1104,15 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
...
@@ -1056,15 +1104,15 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
act
=
actual
[
j
];
act
=
actual
[
j
];
if
(
flags
==
UNITY_ARRAY_TO_ARRAY
)
if
(
flags
==
UNITY_ARRAY_TO_ARRAY
)
{
{
exp
=
((
const
char
*
const
*
)
expected
)[
j
];
exp
d
=
((
const
char
*
const
*
)
expected
)[
j
];
}
}
/* if both pointers not null compare the strings */
/* if both pointers not null compare the strings */
if
(
exp
&&
act
)
if
(
exp
d
&&
act
)
{
{
for
(
i
=
0
;
exp
[
i
]
||
act
[
i
];
i
++
)
for
(
i
=
0
;
exp
d
[
i
]
||
act
[
i
];
i
++
)
{
{
if
(
exp
[
i
]
!=
act
[
i
])
if
(
exp
d
[
i
]
!=
act
[
i
])
{
{
Unity
.
CurrentTestFailed
=
1
;
Unity
.
CurrentTestFailed
=
1
;
break
;
break
;
...
@@ -1073,7 +1121,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
...
@@ -1073,7 +1121,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
}
}
else
else
{
/* handle case of one pointers being null (if both null, test should pass) */
{
/* handle case of one pointers being null (if both null, test should pass) */
if
(
exp
!=
act
)
if
(
exp
d
!=
act
)
{
{
Unity
.
CurrentTestFailed
=
1
;
Unity
.
CurrentTestFailed
=
1
;
}
}
...
@@ -1087,7 +1135,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
...
@@ -1087,7 +1135,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
UnityPrint
(
UnityStrElement
);
UnityPrint
(
UnityStrElement
);
UnityPrintNumberUnsigned
(
j
);
UnityPrintNumberUnsigned
(
j
);
}
}
UnityPrintExpectedAndActualStrings
(
exp
,
act
);
UnityPrintExpectedAndActualStrings
(
exp
d
,
act
);
UnityAddMsgIfSpecified
(
msg
);
UnityAddMsgIfSpecified
(
msg
);
UNITY_FAIL_AND_BAIL
;
UNITY_FAIL_AND_BAIL
;
}
}
...
...
tests/unity/src/unity.h
浏览文件 @
acf80470
...
@@ -114,6 +114,35 @@ void tearDown(void);
...
@@ -114,6 +114,35 @@ void tearDown(void);
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
/* Integer Greater Than/ Less Than (of all sizes) */
#define TEST_ASSERT_GREATER_THAN(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_INT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT8((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_INT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT16((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_INT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT32((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_UINT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT8((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_INT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT8((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_INT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT16((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_INT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT32((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_UINT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_UINT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT8((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
#define TEST_ASSERT_LESS_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
/* Integer Ranges (of all sizes) */
/* Integer Ranges (of all sizes) */
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
...
@@ -157,6 +186,8 @@ void tearDown(void);
...
@@ -157,6 +186,8 @@ void tearDown(void);
#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, NULL)
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, NULL)
/* Arrays Compared To Single Value */
/* Arrays Compared To Single Value */
#define TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, NULL)
#define TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, NULL)
#define TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT8((expected), (actual), (num_elements), __LINE__, NULL)
#define TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT8((expected), (actual), (num_elements), __LINE__, NULL)
...
@@ -241,6 +272,35 @@ void tearDown(void);
...
@@ -241,6 +272,35 @@ void tearDown(void);
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, (message))
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, (message))
/* Integer Greater Than/ Less Than (of all sizes) */
#define TEST_ASSERT_GREATER_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT8((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT16((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT32((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT8((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_GREATER_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT8((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT16((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT32((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT8((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, (message))
#define TEST_ASSERT_LESS_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, (message))
/* Integer Ranges (of all sizes) */
/* Integer Ranges (of all sizes) */
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, (message))
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, (message))
#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, (message))
#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, (message))
...
...
tests/unity/src/unity_internals.h
浏览文件 @
acf80470
...
@@ -244,8 +244,8 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
...
@@ -244,8 +244,8 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
#else
#else
/* If defined as something else, make sure we declare it here so it's ready for use */
/* If defined as something else, make sure we declare it here so it's ready for use */
#if
ndef UNITY_OMIT
_OUTPUT_CHAR_HEADER_DECLARATION
#if
def UNITY
_OUTPUT_CHAR_HEADER_DECLARATION
extern
void
UNITY_OUTPUT_CHAR
(
int
)
;
extern
void
UNITY_OUTPUT_CHAR
_HEADER_DECLARATION
;
#endif
#endif
#endif
#endif
...
@@ -253,22 +253,22 @@ extern void UNITY_OUTPUT_CHAR(int);
...
@@ -253,22 +253,22 @@ extern void UNITY_OUTPUT_CHAR(int);
#ifdef UNITY_USE_FLUSH_STDOUT
#ifdef UNITY_USE_FLUSH_STDOUT
/* We want to use the stdout flush utility */
/* We want to use the stdout flush utility */
#include <stdio.h>
#include <stdio.h>
#define UNITY_OUTPUT_FLUSH (void)fflush(stdout)
#define UNITY_OUTPUT_FLUSH
()
(void)fflush(stdout)
#else
#else
/* We've specified nothing, therefore flush should just be ignored */
/* We've specified nothing, therefore flush should just be ignored */
#define UNITY_OUTPUT_FLUSH
#define UNITY_OUTPUT_FLUSH
()
#endif
#endif
#else
#else
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
#if
ndef UNITY_OMIT
_OUTPUT_FLUSH_HEADER_DECLARATION
#if
def UNITY
_OUTPUT_FLUSH_HEADER_DECLARATION
extern
void
UNITY_O
UTPUT_FLUSH
(
void
)
;
extern
void
UNITY_O
MIT_OUTPUT_FLUSH_HEADER_DECLARATION
;
#endif
#endif
#endif
#endif
#ifndef UNITY_OUTPUT_FLUSH
#ifndef UNITY_OUTPUT_FLUSH
#define UNITY_FLUSH_CALL()
#define UNITY_FLUSH_CALL()
#else
#else
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
()
#endif
#endif
#ifndef UNITY_PRINT_EOL
#ifndef UNITY_PRINT_EOL
...
@@ -453,6 +453,18 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
...
@@ -453,6 +453,18 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
const
UNITY_LINE_TYPE
lineNumber
,
const
UNITY_LINE_TYPE
lineNumber
,
const
UNITY_DISPLAY_STYLE_T
style
);
const
UNITY_DISPLAY_STYLE_T
style
);
void
UnityAssertGreaterNumber
(
const
UNITY_INT
threshold
,
const
UNITY_INT
actual
,
const
char
*
msg
,
const
UNITY_LINE_TYPE
lineNumber
,
const
UNITY_DISPLAY_STYLE_T
style
);
void
UnityAssertSmallerNumber
(
const
UNITY_INT
threshold
,
const
UNITY_INT
actual
,
const
char
*
msg
,
const
UNITY_LINE_TYPE
lineNumber
,
const
UNITY_DISPLAY_STYLE_T
style
);
void
UnityAssertEqualIntArray
(
UNITY_INTERNAL_PTR
expected
,
void
UnityAssertEqualIntArray
(
UNITY_INTERNAL_PTR
expected
,
UNITY_INTERNAL_PTR
actual
,
UNITY_INTERNAL_PTR
actual
,
const
UNITY_UINT32
num_elements
,
const
UNITY_UINT32
num_elements
,
...
@@ -650,6 +662,34 @@ int UnityTestMatches(void);
...
@@ -650,6 +662,34 @@ int UnityTestMatches(void);
#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((UNITY_INT)(mask), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line))
#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((UNITY_INT)(mask), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line))
#define UNITY_TEST_ASSERT_GREATER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT8(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT16(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT32(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT8(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT16(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT32(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT8(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT16(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT32(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX8(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX16(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX32(threshold, actual, line, message) UnityAssertSmallerNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
...
...
tests/unity/test/Makefile
浏览文件 @
acf80470
...
@@ -14,6 +14,7 @@ CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstri
...
@@ -14,6 +14,7 @@ CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstri
#DEBUG = -O0 -g
#DEBUG = -O0 -g
CFLAGS
+=
$(DEBUG)
CFLAGS
+=
$(DEBUG)
DEFINES
=
-D
UNITY_OUTPUT_CHAR
=
putcharSpy
DEFINES
=
-D
UNITY_OUTPUT_CHAR
=
putcharSpy
DEFINES
+=
-D
UNITY_OUTPUT_CHAR_HEADER_DECLARATION
=
putcharSpy
\(
int
\)
DEFINES
+=
-D
UNITY_SUPPORT_64
-D
UNITY_INCLUDE_DOUBLE
DEFINES
+=
-D
UNITY_SUPPORT_64
-D
UNITY_INCLUDE_DOUBLE
SRC
=
../src/unity.c tests/testunity.c build/testunityRunner.c
SRC
=
../src/unity.c tests/testunity.c build/testunityRunner.c
INC_DIR
=
-I
../src
INC_DIR
=
-I
../src
...
...
tests/unity/test/rakefile_helper.rb
浏览文件 @
acf80470
...
@@ -91,7 +91,7 @@ module RakefileHelpers
...
@@ -91,7 +91,7 @@ module RakefileHelpers
defines
=
if
$cfg
[
'compiler'
][
'defines'
][
'items'
].
nil?
defines
=
if
$cfg
[
'compiler'
][
'defines'
][
'items'
].
nil?
''
''
else
else
squash
(
$cfg
[
'compiler'
][
'defines'
][
'prefix'
],
$cfg
[
'compiler'
][
'defines'
][
'items'
]
+
[
'UNITY_OUTPUT_CHAR=putcharSpy'
]
+
inject_defines
)
squash
(
$cfg
[
'compiler'
][
'defines'
][
'prefix'
],
$cfg
[
'compiler'
][
'defines'
][
'items'
]
+
[
'UNITY_OUTPUT_CHAR=putcharSpy'
]
+
[
'UNITY_OUTPUT_CHAR_HEADER_DECLARATION=putcharSpy\(int\)'
]
+
inject_defines
)
end
end
options
=
squash
(
''
,
$cfg
[
'compiler'
][
'options'
])
options
=
squash
(
''
,
$cfg
[
'compiler'
][
'options'
])
includes
=
squash
(
$cfg
[
'compiler'
][
'includes'
][
'prefix'
],
$cfg
[
'compiler'
][
'includes'
][
'items'
])
includes
=
squash
(
$cfg
[
'compiler'
][
'includes'
][
'prefix'
],
$cfg
[
'compiler'
][
'includes'
][
'items'
])
...
...
tests/unity/test/tests/testunity.c
浏览文件 @
acf80470
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录