diff --git a/src/unity.c b/src/unity.c index d7df8efb5ffe4529cff8f305a44fc4c3c9a32f6a..2316a64a696ee93dfb13c8cc4847f2933256070a 100644 --- a/src/unity.c +++ b/src/unity.c @@ -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) { - UnityPrintNumberUnsigned((_U_UINT)number); + UnityPrintNumberUnsigned(((_U_UINT)number & ((_U_UINT)1 << (((int)style & 0x000F) << 3)) - 1)); } else { UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); } + } //----------------------------------------------- diff --git a/targets/iar_arm_v5_3.yml b/targets/iar_arm_v5_3.yml new file mode 100644 index 0000000000000000000000000000000000000000..915330a8e23cd8d9d8b0c0200c874bf0e0faf6fb --- /dev/null +++ b/targets/iar_arm_v5_3.yml @@ -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: [] \ No newline at end of file diff --git a/targets/iar_armcortex_LM3S9B92_v5_4.yml b/targets/iar_armcortex_LM3S9B92_v5_4.yml new file mode 100644 index 0000000000000000000000000000000000000000..8f10a0e0439c6b414d9a24b82007051149c63d63 --- /dev/null +++ b/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -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: [] \ No newline at end of file diff --git a/test/testunity.c b/test/testunity.c index 153cc1a70a685278fa90027cd672c474c26f4626..9ce4b9719e243cd628c3c99ef21b5074585cbc6c 100644 --- a/test/testunity.c +++ b/test/testunity.c @@ -161,6 +161,27 @@ void testNotEqualInts(void) 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) { EXPECT_ABORT_BEGIN @@ -180,6 +201,42 @@ void testNotEqualUInts(void) 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) { _UU8 v0, v1; @@ -942,6 +999,50 @@ void testNotEqualInt16Arrays(void) 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) { unsigned int p0[] = {1, 8, 987, 65132u};