mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-27 21:12:55 +08:00
- fixed pretty-printing error with small uint sizes
- added a couple of user-submitted ports git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@119 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
@ -77,12 +77,13 @@ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T s
|
|||||||
}
|
}
|
||||||
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
|
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
|
||||||
{
|
{
|
||||||
UnityPrintNumberUnsigned((_U_UINT)number);
|
UnityPrintNumberUnsigned(((_U_UINT)number & ((_U_UINT)1 << (((int)style & 0x000F) << 3)) - 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1);
|
UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
79
targets/iar_arm_v5_3.yml
Normal file
79
targets/iar_arm_v5_3.yml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
|
||||||
|
compiler:
|
||||||
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
|
source_path: 'src\'
|
||||||
|
unit_tests_path: &unit_tests_path 'test\'
|
||||||
|
build_path: &build_path 'build\'
|
||||||
|
options:
|
||||||
|
- --dlib_config
|
||||||
|
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
|
||||||
|
- --no_cse
|
||||||
|
- --no_unroll
|
||||||
|
- --no_inline
|
||||||
|
- --no_code_motion
|
||||||
|
- --no_tbaa
|
||||||
|
- --no_clustering
|
||||||
|
- --no_scheduling
|
||||||
|
- --debug
|
||||||
|
- --cpu_mode thumb
|
||||||
|
- --endian=little
|
||||||
|
- --cpu=ARM7TDMI
|
||||||
|
- --interwork
|
||||||
|
- --warnings_are_errors
|
||||||
|
- --fpu=None
|
||||||
|
- --diag_suppress=Pa050
|
||||||
|
- --diag_suppress=Pe111
|
||||||
|
- -e
|
||||||
|
- -On
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\inc\']
|
||||||
|
- 'src\'
|
||||||
|
- '..\src\'
|
||||||
|
- *unit_tests_path
|
||||||
|
- 'vendor\unity\src\'
|
||||||
|
- 'iar\iar_v5\incIAR\'
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
- UNITY_SUPPORT_64
|
||||||
|
- 'UNITY_SUPPORT_TEST_CASES'
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.r79'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: [*tools_root, 'arm\bin\ilinkarm.exe']
|
||||||
|
options:
|
||||||
|
- --redirect _Printf=_PrintfLarge
|
||||||
|
- --redirect _Scanf=_ScanfSmall
|
||||||
|
- --semihosting
|
||||||
|
- --entry __iar_program_start
|
||||||
|
- --config
|
||||||
|
- [*tools_root, 'arm\config\generic.icf']
|
||||||
|
object_files:
|
||||||
|
path: *build_path
|
||||||
|
extension: '.o'
|
||||||
|
bin_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.out'
|
||||||
|
destination: *build_path
|
||||||
|
simulator:
|
||||||
|
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||||
|
pre_support:
|
||||||
|
- --silent
|
||||||
|
- [*tools_root, 'arm\bin\armproc.dll']
|
||||||
|
- [*tools_root, 'arm\bin\armsim.dll']
|
||||||
|
post_support:
|
||||||
|
- --plugin
|
||||||
|
- [*tools_root, 'arm\bin\armbat.dll']
|
||||||
|
- --backend
|
||||||
|
- -B
|
||||||
|
- -p
|
||||||
|
- [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
|
||||||
|
- -d
|
||||||
|
- sim
|
||||||
|
colour: true
|
||||||
|
:unity:
|
||||||
|
:plugins: []
|
93
targets/iar_armcortex_LM3S9B92_v5_4.yml
Normal file
93
targets/iar_armcortex_LM3S9B92_v5_4.yml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#Default tool path for IAR 5.4 on Windows XP 64bit
|
||||||
|
tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\'
|
||||||
|
compiler:
|
||||||
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
|
source_path: 'src\'
|
||||||
|
unit_tests_path: &unit_tests_path 'test\'
|
||||||
|
build_path: &build_path 'build\'
|
||||||
|
options:
|
||||||
|
- --diag_suppress=Pa050
|
||||||
|
#- --diag_suppress=Pe111
|
||||||
|
- --debug
|
||||||
|
- --endian=little
|
||||||
|
- --cpu=Cortex-M3
|
||||||
|
- --no_path_in_file_macros
|
||||||
|
- -e
|
||||||
|
- --fpu=None
|
||||||
|
- --dlib_config
|
||||||
|
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
|
||||||
|
#- --preinclude --preinclude C:\Vss\T2 Working\common\system.h
|
||||||
|
- --interwork
|
||||||
|
- --warnings_are_errors
|
||||||
|
# - Ohz
|
||||||
|
- -Oh
|
||||||
|
# - --no_cse
|
||||||
|
# - --no_unroll
|
||||||
|
# - --no_inline
|
||||||
|
# - --no_code_motion
|
||||||
|
# - --no_tbaa
|
||||||
|
# - --no_clustering
|
||||||
|
# - --no_scheduling
|
||||||
|
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\inc\']
|
||||||
|
- 'src\'
|
||||||
|
- '..\src\'
|
||||||
|
- *unit_tests_path
|
||||||
|
- 'vendor\unity\src\'
|
||||||
|
- 'iar\iar_v5\incIAR\'
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
- ewarm
|
||||||
|
- PART_LM3S9B92
|
||||||
|
- TARGET_IS_TEMPEST_RB1
|
||||||
|
- USE_ROM_DRIVERS
|
||||||
|
- UART_BUFFERED
|
||||||
|
- UNITY_SUPPORT_64
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.r79'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: [*tools_root, 'arm\bin\ilinkarm.exe']
|
||||||
|
options:
|
||||||
|
- --redirect _Printf=_PrintfLarge
|
||||||
|
- --redirect _Scanf=_ScanfSmall
|
||||||
|
- --semihosting
|
||||||
|
- --entry __iar_program_start
|
||||||
|
- --config
|
||||||
|
- [*tools_root, 'arm\config\generic.icf']
|
||||||
|
# - ['C:\Temp\lm3s9b92.icf']
|
||||||
|
object_files:
|
||||||
|
path: *build_path
|
||||||
|
extension: '.o'
|
||||||
|
bin_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.out'
|
||||||
|
destination: *build_path
|
||||||
|
simulator:
|
||||||
|
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||||
|
pre_support:
|
||||||
|
#- --silent
|
||||||
|
- [*tools_root, 'arm\bin\armproc.dll']
|
||||||
|
- [*tools_root, 'arm\bin\armsim2.dll']
|
||||||
|
post_support:
|
||||||
|
- --plugin
|
||||||
|
- [*tools_root, 'arm\bin\armbat.dll']
|
||||||
|
- --backend
|
||||||
|
- -B
|
||||||
|
- --endian=little
|
||||||
|
- --cpu=Cortex-M3
|
||||||
|
- --fpu=None
|
||||||
|
- -p
|
||||||
|
- [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf']
|
||||||
|
- --semihosting
|
||||||
|
- --device=LM3SxBxx
|
||||||
|
#- -d
|
||||||
|
#- sim
|
||||||
|
colour: true
|
||||||
|
:unity:
|
||||||
|
:plugins: []
|
101
test/testunity.c
101
test/testunity.c
@ -161,6 +161,27 @@ void testNotEqualInts(void)
|
|||||||
VERIFY_FAILS_END
|
VERIFY_FAILS_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testNotEqualInt8s(void)
|
||||||
|
{
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_INT8(-127, -126);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualInt16s(void)
|
||||||
|
{
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_INT16(-16383, -16382);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualInt32s(void)
|
||||||
|
{
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
void testNotEqualBits(void)
|
void testNotEqualBits(void)
|
||||||
{
|
{
|
||||||
EXPECT_ABORT_BEGIN
|
EXPECT_ABORT_BEGIN
|
||||||
@ -180,6 +201,42 @@ void testNotEqualUInts(void)
|
|||||||
VERIFY_FAILS_END
|
VERIFY_FAILS_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testNotEqualUInt8s(void)
|
||||||
|
{
|
||||||
|
_UU8 v0, v1;
|
||||||
|
|
||||||
|
v0 = 254;
|
||||||
|
v1 = 255;
|
||||||
|
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_UINT8(v0, v1);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualUInt16s(void)
|
||||||
|
{
|
||||||
|
_UU16 v0, v1;
|
||||||
|
|
||||||
|
v0 = 65535;
|
||||||
|
v1 = 65534;
|
||||||
|
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_UINT16(v0, v1);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualUInt32s(void)
|
||||||
|
{
|
||||||
|
_UU32 v0, v1;
|
||||||
|
|
||||||
|
v0 = 4294967295;
|
||||||
|
v1 = 4294967294;
|
||||||
|
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_UINT32(v0, v1);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
void testNotEqualHex8s(void)
|
void testNotEqualHex8s(void)
|
||||||
{
|
{
|
||||||
_UU8 v0, v1;
|
_UU8 v0, v1;
|
||||||
@ -942,6 +999,50 @@ void testNotEqualInt16Arrays(void)
|
|||||||
VERIFY_FAILS_END
|
VERIFY_FAILS_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testEqualUINT16Arrays(void)
|
||||||
|
{
|
||||||
|
unsigned short p0[] = {1, 8, 987, 65132u};
|
||||||
|
unsigned short p1[] = {1, 8, 987, 65132u};
|
||||||
|
unsigned short p2[] = {1, 8, 987, 2};
|
||||||
|
unsigned short p3[] = {1, 500, 600, 700};
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1);
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4);
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3);
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualUINT16Arrays1(void)
|
||||||
|
{
|
||||||
|
unsigned short p0[] = {1, 8, 987, 65132u};
|
||||||
|
unsigned short p1[] = {1, 8, 987, 65131u};
|
||||||
|
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualUINT16Arrays2(void)
|
||||||
|
{
|
||||||
|
unsigned short p0[] = {1, 8, 987, 65132u};
|
||||||
|
unsigned short p1[] = {2, 8, 987, 65132u};
|
||||||
|
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNotEqualUINT16Arrays3(void)
|
||||||
|
{
|
||||||
|
unsigned short p0[] = {1, 8, 987, 65132u};
|
||||||
|
unsigned short p1[] = {1, 8, 986, 65132u};
|
||||||
|
|
||||||
|
EXPECT_ABORT_BEGIN
|
||||||
|
TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
|
||||||
|
VERIFY_FAILS_END
|
||||||
|
}
|
||||||
|
|
||||||
void testEqualHEXArrays(void)
|
void testEqualHEXArrays(void)
|
||||||
{
|
{
|
||||||
unsigned int p0[] = {1, 8, 987, 65132u};
|
unsigned int p0[] = {1, 8, 987, 65132u};
|
||||||
|
Reference in New Issue
Block a user