From 46560a8030e10cfe86bef21d076b023ec9903d69 Mon Sep 17 00:00:00 2001 From: jsalling Date: Mon, 28 Nov 2016 23:39:11 -0600 Subject: [PATCH] Add correct masking behavior on unsigned values --- src/unity.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/unity.c b/src/unity.c index f45e440..c1be293 100644 --- a/src/unity.c +++ b/src/unity.c @@ -620,6 +620,13 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected, if (expect_val != actual_val) { + if (style & UNITY_DISPLAY_RANGE_UINT && length < sizeof expect_val) + { /* For UINT, remove sign extension (padding 1's) from signed type casts above */ + UNITY_INT mask = 1; + mask = (mask << 8 * length) - 1; + expect_val &= mask; + actual_val &= mask; + } UnityTestResultsFailBegin(lineNumber); UnityPrint(UnityStrElement); UnityPrintNumberUnsigned(num_elements - elements - 1);