Greg Steiert / pegasus_dev

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Nov 11 20:59:50 2016 +0000
Revision:
0:5c4d7b2438d3
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* =========================================================================
switches 0:5c4d7b2438d3 2 Unity Project - A Test Framework for C
switches 0:5c4d7b2438d3 3 Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
switches 0:5c4d7b2438d3 4 [Released under MIT License. Please refer to license.txt for details]
switches 0:5c4d7b2438d3 5 ============================================================================ */
switches 0:5c4d7b2438d3 6
switches 0:5c4d7b2438d3 7 #include "unity/unity.h"
switches 0:5c4d7b2438d3 8 #include "utest/unity_handler.h"
switches 0:5c4d7b2438d3 9 #include <stddef.h>
switches 0:5c4d7b2438d3 10
switches 0:5c4d7b2438d3 11 /* If omitted from header, declare overrideable prototypes here so they're ready for use */
switches 0:5c4d7b2438d3 12 #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
switches 0:5c4d7b2438d3 13 int UNITY_OUTPUT_CHAR(int);
switches 0:5c4d7b2438d3 14 #endif
switches 0:5c4d7b2438d3 15 #ifdef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
switches 0:5c4d7b2438d3 16 int UNITY_OUTPUT_FLUSH(void);
switches 0:5c4d7b2438d3 17 #endif
switches 0:5c4d7b2438d3 18
switches 0:5c4d7b2438d3 19 /* Helpful macros for us to use here */
switches 0:5c4d7b2438d3 20 #define UNITY_FAIL_AND_BAIL { UNITY_OUTPUT_CHAR('\n'); utest_unity_assert_failure(); }
switches 0:5c4d7b2438d3 21 #define UNITY_IGNORE_AND_BAIL { UNITY_OUTPUT_CHAR('\n'); utest_unity_ignore_failure(); }
switches 0:5c4d7b2438d3 22
switches 0:5c4d7b2438d3 23 /* return prematurely if we are already in failure or ignore state */
switches 0:5c4d7b2438d3 24 #define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
switches 0:5c4d7b2438d3 25
switches 0:5c4d7b2438d3 26 struct _Unity Unity;
switches 0:5c4d7b2438d3 27
switches 0:5c4d7b2438d3 28 static const char UnityStrOk[] = "OK";
switches 0:5c4d7b2438d3 29 static const char UnityStrPass[] = "PASS";
switches 0:5c4d7b2438d3 30 static const char UnityStrFail[] = "FAIL";
switches 0:5c4d7b2438d3 31 static const char UnityStrIgnore[] = "IGNORE";
switches 0:5c4d7b2438d3 32 static const char UnityStrNull[] = "NULL";
switches 0:5c4d7b2438d3 33 static const char UnityStrSpacer[] = ". ";
switches 0:5c4d7b2438d3 34 static const char UnityStrExpected[] = " Expected ";
switches 0:5c4d7b2438d3 35 static const char UnityStrWas[] = " Was ";
switches 0:5c4d7b2438d3 36 static const char UnityStrElement[] = " Element ";
switches 0:5c4d7b2438d3 37 static const char UnityStrByte[] = " Byte ";
switches 0:5c4d7b2438d3 38 static const char UnityStrMemory[] = " Memory Mismatch.";
switches 0:5c4d7b2438d3 39 static const char UnityStrDelta[] = " Values Not Within Delta ";
switches 0:5c4d7b2438d3 40 static const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
switches 0:5c4d7b2438d3 41 static const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
switches 0:5c4d7b2438d3 42 static const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";
switches 0:5c4d7b2438d3 43 static const char UnityStrNot[] = "Not ";
switches 0:5c4d7b2438d3 44 static const char UnityStrInf[] = "Infinity";
switches 0:5c4d7b2438d3 45 static const char UnityStrNegInf[] = "Negative Infinity";
switches 0:5c4d7b2438d3 46 static const char UnityStrNaN[] = "NaN";
switches 0:5c4d7b2438d3 47 static const char UnityStrDet[] = "Determinate";
switches 0:5c4d7b2438d3 48 static const char UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
switches 0:5c4d7b2438d3 49 const char UnityStrErrFloat[] = "Unity Floating Point Disabled";
switches 0:5c4d7b2438d3 50 const char UnityStrErrDouble[] = "Unity Double Precision Disabled";
switches 0:5c4d7b2438d3 51 const char UnityStrErr64[] = "Unity 64-bit Support Disabled";
switches 0:5c4d7b2438d3 52 static const char UnityStrBreaker[] = "-----------------------";
switches 0:5c4d7b2438d3 53 static const char UnityStrResultsTests[] = " Tests ";
switches 0:5c4d7b2438d3 54 static const char UnityStrResultsFailures[] = " Failures ";
switches 0:5c4d7b2438d3 55 static const char UnityStrResultsIgnored[] = " Ignored ";
switches 0:5c4d7b2438d3 56 static const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
switches 0:5c4d7b2438d3 57 static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
switches 0:5c4d7b2438d3 58
switches 0:5c4d7b2438d3 59 #ifdef UNITY_FLOAT_NEEDS_ZERO
switches 0:5c4d7b2438d3 60 /* Dividing by these constants produces +/- infinity.
switches 0:5c4d7b2438d3 61 * The rationale is given in UnityAssertFloatIsInf's body. */
switches 0:5c4d7b2438d3 62 static const _UF f_zero = 0.0f;
switches 0:5c4d7b2438d3 63 #endif
switches 0:5c4d7b2438d3 64
switches 0:5c4d7b2438d3 65 /* compiler-generic print formatting masks */
switches 0:5c4d7b2438d3 66 static const _U_UINT UnitySizeMask[] =
switches 0:5c4d7b2438d3 67 {
switches 0:5c4d7b2438d3 68 255u, /* 0xFF */
switches 0:5c4d7b2438d3 69 65535u, /* 0xFFFF */
switches 0:5c4d7b2438d3 70 65535u,
switches 0:5c4d7b2438d3 71 4294967295u, /* 0xFFFFFFFF */
switches 0:5c4d7b2438d3 72 4294967295u,
switches 0:5c4d7b2438d3 73 4294967295u,
switches 0:5c4d7b2438d3 74 4294967295u
switches 0:5c4d7b2438d3 75 #ifdef UNITY_SUPPORT_64
switches 0:5c4d7b2438d3 76 ,0xFFFFFFFFFFFFFFFFull
switches 0:5c4d7b2438d3 77 #endif
switches 0:5c4d7b2438d3 78 };
switches 0:5c4d7b2438d3 79
switches 0:5c4d7b2438d3 80 /*-----------------------------------------------
switches 0:5c4d7b2438d3 81 * Pretty Printers & Test Result Output Handlers
switches 0:5c4d7b2438d3 82 *-----------------------------------------------*/
switches 0:5c4d7b2438d3 83
switches 0:5c4d7b2438d3 84 void UnityPrint(const char* string)
switches 0:5c4d7b2438d3 85 {
switches 0:5c4d7b2438d3 86 const char* pch = string;
switches 0:5c4d7b2438d3 87
switches 0:5c4d7b2438d3 88 if (pch != NULL)
switches 0:5c4d7b2438d3 89 {
switches 0:5c4d7b2438d3 90 while (*pch)
switches 0:5c4d7b2438d3 91 {
switches 0:5c4d7b2438d3 92 /* printable characters plus CR & LF are printed */
switches 0:5c4d7b2438d3 93 if ((*pch <= 126) && (*pch >= 32))
switches 0:5c4d7b2438d3 94 {
switches 0:5c4d7b2438d3 95 UNITY_OUTPUT_CHAR(*pch);
switches 0:5c4d7b2438d3 96 }
switches 0:5c4d7b2438d3 97 /* write escaped carriage returns */
switches 0:5c4d7b2438d3 98 else if (*pch == 13)
switches 0:5c4d7b2438d3 99 {
switches 0:5c4d7b2438d3 100 UNITY_OUTPUT_CHAR('\\');
switches 0:5c4d7b2438d3 101 UNITY_OUTPUT_CHAR('r');
switches 0:5c4d7b2438d3 102 }
switches 0:5c4d7b2438d3 103 /* write escaped line feeds */
switches 0:5c4d7b2438d3 104 else if (*pch == 10)
switches 0:5c4d7b2438d3 105 {
switches 0:5c4d7b2438d3 106 UNITY_OUTPUT_CHAR('\\');
switches 0:5c4d7b2438d3 107 UNITY_OUTPUT_CHAR('n');
switches 0:5c4d7b2438d3 108 }
switches 0:5c4d7b2438d3 109 /* unprintable characters are shown as codes */
switches 0:5c4d7b2438d3 110 else
switches 0:5c4d7b2438d3 111 {
switches 0:5c4d7b2438d3 112 UNITY_OUTPUT_CHAR('\\');
switches 0:5c4d7b2438d3 113 UnityPrintNumberHex((_U_UINT)*pch, 2);
switches 0:5c4d7b2438d3 114 }
switches 0:5c4d7b2438d3 115 pch++;
switches 0:5c4d7b2438d3 116 }
switches 0:5c4d7b2438d3 117 }
switches 0:5c4d7b2438d3 118 }
switches 0:5c4d7b2438d3 119
switches 0:5c4d7b2438d3 120 void UnityPrintLen(const char* string, const _UU32 length);
switches 0:5c4d7b2438d3 121 void UnityPrintLen(const char* string, const _UU32 length)
switches 0:5c4d7b2438d3 122 {
switches 0:5c4d7b2438d3 123 const char* pch = string;
switches 0:5c4d7b2438d3 124
switches 0:5c4d7b2438d3 125 if (pch != NULL)
switches 0:5c4d7b2438d3 126 {
switches 0:5c4d7b2438d3 127 while (*pch && (_UU32)(pch - string) < length)
switches 0:5c4d7b2438d3 128 {
switches 0:5c4d7b2438d3 129 /* printable characters plus CR & LF are printed */
switches 0:5c4d7b2438d3 130 if ((*pch <= 126) && (*pch >= 32))
switches 0:5c4d7b2438d3 131 {
switches 0:5c4d7b2438d3 132 UNITY_OUTPUT_CHAR(*pch);
switches 0:5c4d7b2438d3 133 }
switches 0:5c4d7b2438d3 134 /* write escaped carriage returns */
switches 0:5c4d7b2438d3 135 else if (*pch == 13)
switches 0:5c4d7b2438d3 136 {
switches 0:5c4d7b2438d3 137 UNITY_OUTPUT_CHAR('\\');
switches 0:5c4d7b2438d3 138 UNITY_OUTPUT_CHAR('r');
switches 0:5c4d7b2438d3 139 }
switches 0:5c4d7b2438d3 140 /* write escaped line feeds */
switches 0:5c4d7b2438d3 141 else if (*pch == 10)
switches 0:5c4d7b2438d3 142 {
switches 0:5c4d7b2438d3 143 UNITY_OUTPUT_CHAR('\\');
switches 0:5c4d7b2438d3 144 UNITY_OUTPUT_CHAR('n');
switches 0:5c4d7b2438d3 145 }
switches 0:5c4d7b2438d3 146 /* unprintable characters are shown as codes */
switches 0:5c4d7b2438d3 147 else
switches 0:5c4d7b2438d3 148 {
switches 0:5c4d7b2438d3 149 UNITY_OUTPUT_CHAR('\\');
switches 0:5c4d7b2438d3 150 UnityPrintNumberHex((_U_UINT)*pch, 2);
switches 0:5c4d7b2438d3 151 }
switches 0:5c4d7b2438d3 152 pch++;
switches 0:5c4d7b2438d3 153 }
switches 0:5c4d7b2438d3 154 }
switches 0:5c4d7b2438d3 155 }
switches 0:5c4d7b2438d3 156
switches 0:5c4d7b2438d3 157 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 158 void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
switches 0:5c4d7b2438d3 159 {
switches 0:5c4d7b2438d3 160 if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
switches 0:5c4d7b2438d3 161 {
switches 0:5c4d7b2438d3 162 UnityPrintNumber(number);
switches 0:5c4d7b2438d3 163 }
switches 0:5c4d7b2438d3 164 else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
switches 0:5c4d7b2438d3 165 {
switches 0:5c4d7b2438d3 166 UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );
switches 0:5c4d7b2438d3 167 }
switches 0:5c4d7b2438d3 168 else
switches 0:5c4d7b2438d3 169 {
switches 0:5c4d7b2438d3 170 UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));
switches 0:5c4d7b2438d3 171 }
switches 0:5c4d7b2438d3 172 }
switches 0:5c4d7b2438d3 173
switches 0:5c4d7b2438d3 174 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 175 void UnityPrintNumber(const _U_SINT number_to_print)
switches 0:5c4d7b2438d3 176 {
switches 0:5c4d7b2438d3 177 _U_UINT number = (_U_UINT)number_to_print;
switches 0:5c4d7b2438d3 178
switches 0:5c4d7b2438d3 179 if (number_to_print < 0)
switches 0:5c4d7b2438d3 180 {
switches 0:5c4d7b2438d3 181 /* A negative number, including MIN negative */
switches 0:5c4d7b2438d3 182 UNITY_OUTPUT_CHAR('-');
switches 0:5c4d7b2438d3 183 number = (_U_UINT)(-number_to_print);
switches 0:5c4d7b2438d3 184 }
switches 0:5c4d7b2438d3 185 UnityPrintNumberUnsigned(number);
switches 0:5c4d7b2438d3 186 }
switches 0:5c4d7b2438d3 187
switches 0:5c4d7b2438d3 188 /*-----------------------------------------------
switches 0:5c4d7b2438d3 189 * basically do an itoa using as little ram as possible */
switches 0:5c4d7b2438d3 190 void UnityPrintNumberUnsigned(const _U_UINT number)
switches 0:5c4d7b2438d3 191 {
switches 0:5c4d7b2438d3 192 _U_UINT divisor = 1;
switches 0:5c4d7b2438d3 193
switches 0:5c4d7b2438d3 194 /* figure out initial divisor */
switches 0:5c4d7b2438d3 195 while (number / divisor > 9)
switches 0:5c4d7b2438d3 196 {
switches 0:5c4d7b2438d3 197 divisor *= 10;
switches 0:5c4d7b2438d3 198 }
switches 0:5c4d7b2438d3 199
switches 0:5c4d7b2438d3 200 /* now mod and print, then divide divisor */
switches 0:5c4d7b2438d3 201 do
switches 0:5c4d7b2438d3 202 {
switches 0:5c4d7b2438d3 203 UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
switches 0:5c4d7b2438d3 204 divisor /= 10;
switches 0:5c4d7b2438d3 205 }
switches 0:5c4d7b2438d3 206 while (divisor > 0);
switches 0:5c4d7b2438d3 207 }
switches 0:5c4d7b2438d3 208
switches 0:5c4d7b2438d3 209 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 210 void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
switches 0:5c4d7b2438d3 211 {
switches 0:5c4d7b2438d3 212 _U_UINT nibble;
switches 0:5c4d7b2438d3 213 char nibbles = nibbles_to_print;
switches 0:5c4d7b2438d3 214 UNITY_OUTPUT_CHAR('0');
switches 0:5c4d7b2438d3 215 UNITY_OUTPUT_CHAR('x');
switches 0:5c4d7b2438d3 216
switches 0:5c4d7b2438d3 217 while (nibbles > 0)
switches 0:5c4d7b2438d3 218 {
switches 0:5c4d7b2438d3 219 nibble = (number >> (--nibbles << 2)) & 0x0000000F;
switches 0:5c4d7b2438d3 220 if (nibble <= 9)
switches 0:5c4d7b2438d3 221 {
switches 0:5c4d7b2438d3 222 UNITY_OUTPUT_CHAR((char)('0' + nibble));
switches 0:5c4d7b2438d3 223 }
switches 0:5c4d7b2438d3 224 else
switches 0:5c4d7b2438d3 225 {
switches 0:5c4d7b2438d3 226 UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
switches 0:5c4d7b2438d3 227 }
switches 0:5c4d7b2438d3 228 }
switches 0:5c4d7b2438d3 229 }
switches 0:5c4d7b2438d3 230
switches 0:5c4d7b2438d3 231 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 232 void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
switches 0:5c4d7b2438d3 233 {
switches 0:5c4d7b2438d3 234 _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
switches 0:5c4d7b2438d3 235 _US32 i;
switches 0:5c4d7b2438d3 236
switches 0:5c4d7b2438d3 237 for (i = 0; i < UNITY_INT_WIDTH; i++)
switches 0:5c4d7b2438d3 238 {
switches 0:5c4d7b2438d3 239 if (current_bit & mask)
switches 0:5c4d7b2438d3 240 {
switches 0:5c4d7b2438d3 241 if (current_bit & number)
switches 0:5c4d7b2438d3 242 {
switches 0:5c4d7b2438d3 243 UNITY_OUTPUT_CHAR('1');
switches 0:5c4d7b2438d3 244 }
switches 0:5c4d7b2438d3 245 else
switches 0:5c4d7b2438d3 246 {
switches 0:5c4d7b2438d3 247 UNITY_OUTPUT_CHAR('0');
switches 0:5c4d7b2438d3 248 }
switches 0:5c4d7b2438d3 249 }
switches 0:5c4d7b2438d3 250 else
switches 0:5c4d7b2438d3 251 {
switches 0:5c4d7b2438d3 252 UNITY_OUTPUT_CHAR('.');
switches 0:5c4d7b2438d3 253 }
switches 0:5c4d7b2438d3 254 current_bit = current_bit >> 1;
switches 0:5c4d7b2438d3 255 }
switches 0:5c4d7b2438d3 256 }
switches 0:5c4d7b2438d3 257
switches 0:5c4d7b2438d3 258 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 259 #ifdef UNITY_FLOAT_VERBOSE
switches 0:5c4d7b2438d3 260 #include <stdio.h>
switches 0:5c4d7b2438d3 261
switches 0:5c4d7b2438d3 262 #ifndef UNITY_VERBOSE_NUMBER_MAX_LENGTH
switches 0:5c4d7b2438d3 263 # ifdef UNITY_DOUBLE_VERBOSE
switches 0:5c4d7b2438d3 264 # define UNITY_VERBOSE_NUMBER_MAX_LENGTH 317
switches 0:5c4d7b2438d3 265 # else
switches 0:5c4d7b2438d3 266 # define UNITY_VERBOSE_NUMBER_MAX_LENGTH 47
switches 0:5c4d7b2438d3 267 # endif
switches 0:5c4d7b2438d3 268 #endif
switches 0:5c4d7b2438d3 269
switches 0:5c4d7b2438d3 270 void UnityPrintFloat(_UF number)
switches 0:5c4d7b2438d3 271 {
switches 0:5c4d7b2438d3 272 char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1];
switches 0:5c4d7b2438d3 273 snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number);
switches 0:5c4d7b2438d3 274 UnityPrint(TempBuffer);
switches 0:5c4d7b2438d3 275 }
switches 0:5c4d7b2438d3 276 #endif
switches 0:5c4d7b2438d3 277
switches 0:5c4d7b2438d3 278 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 279
switches 0:5c4d7b2438d3 280 void UnityPrintFail(void);
switches 0:5c4d7b2438d3 281 void UnityPrintFail(void)
switches 0:5c4d7b2438d3 282 {
switches 0:5c4d7b2438d3 283 UnityPrint(UnityStrFail);
switches 0:5c4d7b2438d3 284 }
switches 0:5c4d7b2438d3 285
switches 0:5c4d7b2438d3 286 void UnityPrintOk(void);
switches 0:5c4d7b2438d3 287 void UnityPrintOk(void)
switches 0:5c4d7b2438d3 288 {
switches 0:5c4d7b2438d3 289 UnityPrint(UnityStrOk);
switches 0:5c4d7b2438d3 290 }
switches 0:5c4d7b2438d3 291
switches 0:5c4d7b2438d3 292 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 293 static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);
switches 0:5c4d7b2438d3 294 static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
switches 0:5c4d7b2438d3 295 {
switches 0:5c4d7b2438d3 296 #ifndef UNITY_FIXTURES
switches 0:5c4d7b2438d3 297 UnityPrint(file);
switches 0:5c4d7b2438d3 298 UNITY_OUTPUT_CHAR(':');
switches 0:5c4d7b2438d3 299 UnityPrintNumber((_U_SINT)line);
switches 0:5c4d7b2438d3 300 UNITY_OUTPUT_CHAR(':');
switches 0:5c4d7b2438d3 301 UnityPrint(Unity.CurrentTestName);
switches 0:5c4d7b2438d3 302 UNITY_OUTPUT_CHAR(':');
switches 0:5c4d7b2438d3 303 #else
switches 0:5c4d7b2438d3 304 UNITY_UNUSED(file);
switches 0:5c4d7b2438d3 305 UNITY_UNUSED(line);
switches 0:5c4d7b2438d3 306 #endif
switches 0:5c4d7b2438d3 307 }
switches 0:5c4d7b2438d3 308
switches 0:5c4d7b2438d3 309 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 310 static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);
switches 0:5c4d7b2438d3 311 static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
switches 0:5c4d7b2438d3 312 {
switches 0:5c4d7b2438d3 313 #ifndef UNITY_FIXTURES
switches 0:5c4d7b2438d3 314 UnityTestResultsBegin(Unity.TestFile, line);
switches 0:5c4d7b2438d3 315 #else
switches 0:5c4d7b2438d3 316 UNITY_UNUSED(line);
switches 0:5c4d7b2438d3 317 #endif
switches 0:5c4d7b2438d3 318 UnityPrint(UnityStrFail);
switches 0:5c4d7b2438d3 319 UNITY_OUTPUT_CHAR(':');
switches 0:5c4d7b2438d3 320 }
switches 0:5c4d7b2438d3 321
switches 0:5c4d7b2438d3 322 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 323 void UnityConcludeTest(void)
switches 0:5c4d7b2438d3 324 {
switches 0:5c4d7b2438d3 325 if (Unity.CurrentTestIgnored)
switches 0:5c4d7b2438d3 326 {
switches 0:5c4d7b2438d3 327 Unity.TestIgnores++;
switches 0:5c4d7b2438d3 328 }
switches 0:5c4d7b2438d3 329 else if (!Unity.CurrentTestFailed)
switches 0:5c4d7b2438d3 330 {
switches 0:5c4d7b2438d3 331 UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
switches 0:5c4d7b2438d3 332 UnityPrint(UnityStrPass);
switches 0:5c4d7b2438d3 333 }
switches 0:5c4d7b2438d3 334 else
switches 0:5c4d7b2438d3 335 {
switches 0:5c4d7b2438d3 336 Unity.TestFailures++;
switches 0:5c4d7b2438d3 337 }
switches 0:5c4d7b2438d3 338
switches 0:5c4d7b2438d3 339 Unity.CurrentTestFailed = 0;
switches 0:5c4d7b2438d3 340 Unity.CurrentTestIgnored = 0;
switches 0:5c4d7b2438d3 341 UNITY_PRINT_EOL();
switches 0:5c4d7b2438d3 342 UNITY_OUTPUT_FLUSH();
switches 0:5c4d7b2438d3 343 }
switches 0:5c4d7b2438d3 344
switches 0:5c4d7b2438d3 345 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 346 static void UnityAddMsgIfSpecified(const char* msg);
switches 0:5c4d7b2438d3 347 static void UnityAddMsgIfSpecified(const char* msg)
switches 0:5c4d7b2438d3 348 {
switches 0:5c4d7b2438d3 349 if (msg)
switches 0:5c4d7b2438d3 350 {
switches 0:5c4d7b2438d3 351 UnityPrint(UnityStrSpacer);
switches 0:5c4d7b2438d3 352 #ifndef UNITY_EXCLUDE_DETAILS
switches 0:5c4d7b2438d3 353 if (Unity.CurrentDetail1)
switches 0:5c4d7b2438d3 354 {
switches 0:5c4d7b2438d3 355 UnityPrint(UnityStrDetail1Name);
switches 0:5c4d7b2438d3 356 UnityPrint(Unity.CurrentDetail1);
switches 0:5c4d7b2438d3 357 if (Unity.CurrentDetail2)
switches 0:5c4d7b2438d3 358 {
switches 0:5c4d7b2438d3 359 UnityPrint(UnityStrDetail2Name);
switches 0:5c4d7b2438d3 360 UnityPrint(Unity.CurrentDetail2);
switches 0:5c4d7b2438d3 361 }
switches 0:5c4d7b2438d3 362 UnityPrint(UnityStrSpacer);
switches 0:5c4d7b2438d3 363 }
switches 0:5c4d7b2438d3 364 #endif
switches 0:5c4d7b2438d3 365 UnityPrint(msg);
switches 0:5c4d7b2438d3 366 }
switches 0:5c4d7b2438d3 367 }
switches 0:5c4d7b2438d3 368
switches 0:5c4d7b2438d3 369 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 370 static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);
switches 0:5c4d7b2438d3 371 static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
switches 0:5c4d7b2438d3 372 {
switches 0:5c4d7b2438d3 373 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 374 if (expected != NULL)
switches 0:5c4d7b2438d3 375 {
switches 0:5c4d7b2438d3 376 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 377 UnityPrint(expected);
switches 0:5c4d7b2438d3 378 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 379 }
switches 0:5c4d7b2438d3 380 else
switches 0:5c4d7b2438d3 381 {
switches 0:5c4d7b2438d3 382 UnityPrint(UnityStrNull);
switches 0:5c4d7b2438d3 383 }
switches 0:5c4d7b2438d3 384 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 385 if (actual != NULL)
switches 0:5c4d7b2438d3 386 {
switches 0:5c4d7b2438d3 387 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 388 UnityPrint(actual);
switches 0:5c4d7b2438d3 389 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 390 }
switches 0:5c4d7b2438d3 391 else
switches 0:5c4d7b2438d3 392 {
switches 0:5c4d7b2438d3 393 UnityPrint(UnityStrNull);
switches 0:5c4d7b2438d3 394 }
switches 0:5c4d7b2438d3 395 }
switches 0:5c4d7b2438d3 396
switches 0:5c4d7b2438d3 397 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 398 static void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const _UU32 length)
switches 0:5c4d7b2438d3 399 {
switches 0:5c4d7b2438d3 400 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 401 if (expected != NULL)
switches 0:5c4d7b2438d3 402 {
switches 0:5c4d7b2438d3 403 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 404 UnityPrintLen(expected, length);
switches 0:5c4d7b2438d3 405 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 406 }
switches 0:5c4d7b2438d3 407 else
switches 0:5c4d7b2438d3 408 {
switches 0:5c4d7b2438d3 409 UnityPrint(UnityStrNull);
switches 0:5c4d7b2438d3 410 }
switches 0:5c4d7b2438d3 411 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 412 if (actual != NULL)
switches 0:5c4d7b2438d3 413 {
switches 0:5c4d7b2438d3 414 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 415 UnityPrintLen(actual, length);
switches 0:5c4d7b2438d3 416 UNITY_OUTPUT_CHAR('\'');
switches 0:5c4d7b2438d3 417 }
switches 0:5c4d7b2438d3 418 else
switches 0:5c4d7b2438d3 419 {
switches 0:5c4d7b2438d3 420 UnityPrint(UnityStrNull);
switches 0:5c4d7b2438d3 421 }
switches 0:5c4d7b2438d3 422 }
switches 0:5c4d7b2438d3 423
switches 0:5c4d7b2438d3 424
switches 0:5c4d7b2438d3 425
switches 0:5c4d7b2438d3 426 /*-----------------------------------------------
switches 0:5c4d7b2438d3 427 * Assertion & Control Helpers
switches 0:5c4d7b2438d3 428 *-----------------------------------------------*/
switches 0:5c4d7b2438d3 429
switches 0:5c4d7b2438d3 430 static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_PTR actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
switches 0:5c4d7b2438d3 431 {
switches 0:5c4d7b2438d3 432 /* return true if they are both NULL */
switches 0:5c4d7b2438d3 433 if ((expected == NULL) && (actual == NULL))
switches 0:5c4d7b2438d3 434 return 1;
switches 0:5c4d7b2438d3 435
switches 0:5c4d7b2438d3 436 /* throw error if just expected is NULL */
switches 0:5c4d7b2438d3 437 if (expected == NULL)
switches 0:5c4d7b2438d3 438 {
switches 0:5c4d7b2438d3 439 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 440 UnityPrint(UnityStrNullPointerForExpected);
switches 0:5c4d7b2438d3 441 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 442 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 443 }
switches 0:5c4d7b2438d3 444
switches 0:5c4d7b2438d3 445 /* throw error if just actual is NULL */
switches 0:5c4d7b2438d3 446 if (actual == NULL)
switches 0:5c4d7b2438d3 447 {
switches 0:5c4d7b2438d3 448 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 449 UnityPrint(UnityStrNullPointerForActual);
switches 0:5c4d7b2438d3 450 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 451 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 452 }
switches 0:5c4d7b2438d3 453
switches 0:5c4d7b2438d3 454 /* return false if neither is NULL */
switches 0:5c4d7b2438d3 455 return 0;
switches 0:5c4d7b2438d3 456 }
switches 0:5c4d7b2438d3 457
switches 0:5c4d7b2438d3 458 /*-----------------------------------------------
switches 0:5c4d7b2438d3 459 * Assertion Functions
switches 0:5c4d7b2438d3 460 *-----------------------------------------------*/
switches 0:5c4d7b2438d3 461
switches 0:5c4d7b2438d3 462 void UnityAssertBits(const _U_SINT mask,
switches 0:5c4d7b2438d3 463 const _U_SINT expected,
switches 0:5c4d7b2438d3 464 const _U_SINT actual,
switches 0:5c4d7b2438d3 465 const char* msg,
switches 0:5c4d7b2438d3 466 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 467 {
switches 0:5c4d7b2438d3 468 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 469
switches 0:5c4d7b2438d3 470 if ((mask & expected) != (mask & actual))
switches 0:5c4d7b2438d3 471 {
switches 0:5c4d7b2438d3 472 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 473 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 474 UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);
switches 0:5c4d7b2438d3 475 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 476 UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);
switches 0:5c4d7b2438d3 477 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 478 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 479 }
switches 0:5c4d7b2438d3 480 }
switches 0:5c4d7b2438d3 481
switches 0:5c4d7b2438d3 482 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 483 void UnityAssertEqualNumber(const _U_SINT expected,
switches 0:5c4d7b2438d3 484 const _U_SINT actual,
switches 0:5c4d7b2438d3 485 const char* msg,
switches 0:5c4d7b2438d3 486 const UNITY_LINE_TYPE lineNumber,
switches 0:5c4d7b2438d3 487 const UNITY_DISPLAY_STYLE_T style)
switches 0:5c4d7b2438d3 488 {
switches 0:5c4d7b2438d3 489 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 490
switches 0:5c4d7b2438d3 491 if (expected != actual)
switches 0:5c4d7b2438d3 492 {
switches 0:5c4d7b2438d3 493 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 494 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 495 UnityPrintNumberByStyle(expected, style);
switches 0:5c4d7b2438d3 496 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 497 UnityPrintNumberByStyle(actual, style);
switches 0:5c4d7b2438d3 498 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 499 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 500 }
switches 0:5c4d7b2438d3 501 }
switches 0:5c4d7b2438d3 502
switches 0:5c4d7b2438d3 503 #define UnityPrintPointlessAndBail() \
switches 0:5c4d7b2438d3 504 { \
switches 0:5c4d7b2438d3 505 UnityTestResultsFailBegin(lineNumber); \
switches 0:5c4d7b2438d3 506 UnityPrint(UnityStrPointless); \
switches 0:5c4d7b2438d3 507 UnityAddMsgIfSpecified(msg); \
switches 0:5c4d7b2438d3 508 UNITY_FAIL_AND_BAIL; }
switches 0:5c4d7b2438d3 509
switches 0:5c4d7b2438d3 510 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 511 void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
switches 0:5c4d7b2438d3 512 UNITY_INTERNAL_PTR actual,
switches 0:5c4d7b2438d3 513 const _UU32 num_elements,
switches 0:5c4d7b2438d3 514 const char* msg,
switches 0:5c4d7b2438d3 515 const UNITY_LINE_TYPE lineNumber,
switches 0:5c4d7b2438d3 516 const UNITY_DISPLAY_STYLE_T style)
switches 0:5c4d7b2438d3 517 {
switches 0:5c4d7b2438d3 518 _UU32 elements = num_elements;
switches 0:5c4d7b2438d3 519 UNITY_INTERNAL_PTR ptr_exp = (UNITY_INTERNAL_PTR)expected;
switches 0:5c4d7b2438d3 520 UNITY_INTERNAL_PTR ptr_act = (UNITY_INTERNAL_PTR)actual;
switches 0:5c4d7b2438d3 521
switches 0:5c4d7b2438d3 522 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 523
switches 0:5c4d7b2438d3 524 if (elements == 0)
switches 0:5c4d7b2438d3 525 {
switches 0:5c4d7b2438d3 526 UnityPrintPointlessAndBail();
switches 0:5c4d7b2438d3 527 }
switches 0:5c4d7b2438d3 528
switches 0:5c4d7b2438d3 529 if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
switches 0:5c4d7b2438d3 530 return;
switches 0:5c4d7b2438d3 531
switches 0:5c4d7b2438d3 532 /* If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
switches 0:5c4d7b2438d3 533 * as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
switches 0:5c4d7b2438d3 534 * variants do not. Therefore remove this flag. */
switches 0:5c4d7b2438d3 535 switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
switches 0:5c4d7b2438d3 536 {
switches 0:5c4d7b2438d3 537 case UNITY_DISPLAY_STYLE_HEX8:
switches 0:5c4d7b2438d3 538 case UNITY_DISPLAY_STYLE_INT8:
switches 0:5c4d7b2438d3 539 case UNITY_DISPLAY_STYLE_UINT8:
switches 0:5c4d7b2438d3 540 while (elements--)
switches 0:5c4d7b2438d3 541 {
switches 0:5c4d7b2438d3 542 if (*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act)
switches 0:5c4d7b2438d3 543 {
switches 0:5c4d7b2438d3 544 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 545 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 546 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 547 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 548 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp, style);
switches 0:5c4d7b2438d3 549 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 550 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act, style);
switches 0:5c4d7b2438d3 551 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 552 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 553 }
switches 0:5c4d7b2438d3 554 ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
switches 0:5c4d7b2438d3 555 ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
switches 0:5c4d7b2438d3 556 }
switches 0:5c4d7b2438d3 557 break;
switches 0:5c4d7b2438d3 558 case UNITY_DISPLAY_STYLE_HEX16:
switches 0:5c4d7b2438d3 559 case UNITY_DISPLAY_STYLE_INT16:
switches 0:5c4d7b2438d3 560 case UNITY_DISPLAY_STYLE_UINT16:
switches 0:5c4d7b2438d3 561 while (elements--)
switches 0:5c4d7b2438d3 562 {
switches 0:5c4d7b2438d3 563 if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)
switches 0:5c4d7b2438d3 564 {
switches 0:5c4d7b2438d3 565 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 566 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 567 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 568 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 569 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);
switches 0:5c4d7b2438d3 570 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 571 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);
switches 0:5c4d7b2438d3 572 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 573 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 574 }
switches 0:5c4d7b2438d3 575 ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 2);
switches 0:5c4d7b2438d3 576 ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 2);
switches 0:5c4d7b2438d3 577 }
switches 0:5c4d7b2438d3 578 break;
switches 0:5c4d7b2438d3 579 #ifdef UNITY_SUPPORT_64
switches 0:5c4d7b2438d3 580 case UNITY_DISPLAY_STYLE_HEX64:
switches 0:5c4d7b2438d3 581 case UNITY_DISPLAY_STYLE_INT64:
switches 0:5c4d7b2438d3 582 case UNITY_DISPLAY_STYLE_UINT64:
switches 0:5c4d7b2438d3 583 while (elements--)
switches 0:5c4d7b2438d3 584 {
switches 0:5c4d7b2438d3 585 if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)
switches 0:5c4d7b2438d3 586 {
switches 0:5c4d7b2438d3 587 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 588 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 589 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 590 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 591 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);
switches 0:5c4d7b2438d3 592 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 593 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);
switches 0:5c4d7b2438d3 594 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 595 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 596 }
switches 0:5c4d7b2438d3 597 ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 8);
switches 0:5c4d7b2438d3 598 ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 8);
switches 0:5c4d7b2438d3 599 }
switches 0:5c4d7b2438d3 600 break;
switches 0:5c4d7b2438d3 601 #endif
switches 0:5c4d7b2438d3 602 default:
switches 0:5c4d7b2438d3 603 while (elements--)
switches 0:5c4d7b2438d3 604 {
switches 0:5c4d7b2438d3 605 if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)
switches 0:5c4d7b2438d3 606 {
switches 0:5c4d7b2438d3 607 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 608 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 609 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 610 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 611 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);
switches 0:5c4d7b2438d3 612 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 613 UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);
switches 0:5c4d7b2438d3 614 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 615 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 616 }
switches 0:5c4d7b2438d3 617 ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 4);
switches 0:5c4d7b2438d3 618 ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 4);
switches 0:5c4d7b2438d3 619 }
switches 0:5c4d7b2438d3 620 break;
switches 0:5c4d7b2438d3 621 }
switches 0:5c4d7b2438d3 622 }
switches 0:5c4d7b2438d3 623
switches 0:5c4d7b2438d3 624 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 625 #ifndef UNITY_EXCLUDE_FLOAT
switches 0:5c4d7b2438d3 626 void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
switches 0:5c4d7b2438d3 627 UNITY_PTR_ATTRIBUTE const _UF* actual,
switches 0:5c4d7b2438d3 628 const _UU32 num_elements,
switches 0:5c4d7b2438d3 629 const char* msg,
switches 0:5c4d7b2438d3 630 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 631 {
switches 0:5c4d7b2438d3 632 _UU32 elements = num_elements;
switches 0:5c4d7b2438d3 633 UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;
switches 0:5c4d7b2438d3 634 UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;
switches 0:5c4d7b2438d3 635 _UF diff, tol;
switches 0:5c4d7b2438d3 636
switches 0:5c4d7b2438d3 637 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 638
switches 0:5c4d7b2438d3 639 if (elements == 0)
switches 0:5c4d7b2438d3 640 {
switches 0:5c4d7b2438d3 641 UnityPrintPointlessAndBail();
switches 0:5c4d7b2438d3 642 }
switches 0:5c4d7b2438d3 643
switches 0:5c4d7b2438d3 644 if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
switches 0:5c4d7b2438d3 645 return;
switches 0:5c4d7b2438d3 646
switches 0:5c4d7b2438d3 647 while (elements--)
switches 0:5c4d7b2438d3 648 {
switches 0:5c4d7b2438d3 649 diff = *ptr_expected - *ptr_actual;
switches 0:5c4d7b2438d3 650 if (diff < 0.0f)
switches 0:5c4d7b2438d3 651 diff = 0.0f - diff;
switches 0:5c4d7b2438d3 652 tol = UNITY_FLOAT_PRECISION * *ptr_expected;
switches 0:5c4d7b2438d3 653 if (tol < 0.0f)
switches 0:5c4d7b2438d3 654 tol = 0.0f - tol;
switches 0:5c4d7b2438d3 655
switches 0:5c4d7b2438d3 656 /* This first part of this condition will catch any NaN or Infinite values */
switches 0:5c4d7b2438d3 657 if (isnan(diff) || isinf(diff) || (diff > tol))
switches 0:5c4d7b2438d3 658 {
switches 0:5c4d7b2438d3 659 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 660 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 661 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 662 #ifdef UNITY_FLOAT_VERBOSE
switches 0:5c4d7b2438d3 663 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 664 UnityPrintFloat(*ptr_expected);
switches 0:5c4d7b2438d3 665 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 666 UnityPrintFloat(*ptr_actual);
switches 0:5c4d7b2438d3 667 #else
switches 0:5c4d7b2438d3 668 UnityPrint(UnityStrDelta);
switches 0:5c4d7b2438d3 669 #endif
switches 0:5c4d7b2438d3 670 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 671 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 672 }
switches 0:5c4d7b2438d3 673 ptr_expected++;
switches 0:5c4d7b2438d3 674 ptr_actual++;
switches 0:5c4d7b2438d3 675 }
switches 0:5c4d7b2438d3 676 }
switches 0:5c4d7b2438d3 677
switches 0:5c4d7b2438d3 678 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 679 void UnityAssertFloatsWithin(const _UF delta,
switches 0:5c4d7b2438d3 680 const _UF expected,
switches 0:5c4d7b2438d3 681 const _UF actual,
switches 0:5c4d7b2438d3 682 const char* msg,
switches 0:5c4d7b2438d3 683 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 684 {
switches 0:5c4d7b2438d3 685 _UF diff = actual - expected;
switches 0:5c4d7b2438d3 686 _UF pos_delta = delta;
switches 0:5c4d7b2438d3 687
switches 0:5c4d7b2438d3 688 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 689
switches 0:5c4d7b2438d3 690 if (diff < 0.0f)
switches 0:5c4d7b2438d3 691 {
switches 0:5c4d7b2438d3 692 diff = 0.0f - diff;
switches 0:5c4d7b2438d3 693 }
switches 0:5c4d7b2438d3 694 if (pos_delta < 0.0f)
switches 0:5c4d7b2438d3 695 {
switches 0:5c4d7b2438d3 696 pos_delta = 0.0f - pos_delta;
switches 0:5c4d7b2438d3 697 }
switches 0:5c4d7b2438d3 698
switches 0:5c4d7b2438d3 699 /* This first part of this condition will catch any NaN or Infinite values */
switches 0:5c4d7b2438d3 700 if (isnan(diff) || isinf(diff) || (pos_delta < diff))
switches 0:5c4d7b2438d3 701 {
switches 0:5c4d7b2438d3 702 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 703 #ifdef UNITY_FLOAT_VERBOSE
switches 0:5c4d7b2438d3 704 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 705 UnityPrintFloat(expected);
switches 0:5c4d7b2438d3 706 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 707 UnityPrintFloat(actual);
switches 0:5c4d7b2438d3 708 #else
switches 0:5c4d7b2438d3 709 UnityPrint(UnityStrDelta);
switches 0:5c4d7b2438d3 710 #endif
switches 0:5c4d7b2438d3 711 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 712 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 713 }
switches 0:5c4d7b2438d3 714 }
switches 0:5c4d7b2438d3 715
switches 0:5c4d7b2438d3 716 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 717 void UnityAssertFloatSpecial(const _UF actual,
switches 0:5c4d7b2438d3 718 const char* msg,
switches 0:5c4d7b2438d3 719 const UNITY_LINE_TYPE lineNumber,
switches 0:5c4d7b2438d3 720 const UNITY_FLOAT_TRAIT_T style)
switches 0:5c4d7b2438d3 721 {
switches 0:5c4d7b2438d3 722 const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
switches 0:5c4d7b2438d3 723 _U_SINT should_be_trait = ((_U_SINT)style & 1);
switches 0:5c4d7b2438d3 724 _U_SINT is_trait = !should_be_trait;
switches 0:5c4d7b2438d3 725 _U_SINT trait_index = (_U_SINT)(style >> 1);
switches 0:5c4d7b2438d3 726
switches 0:5c4d7b2438d3 727 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 728
switches 0:5c4d7b2438d3 729 switch(style)
switches 0:5c4d7b2438d3 730 {
switches 0:5c4d7b2438d3 731 /* To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
switches 0:5c4d7b2438d3 732 * We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise */
switches 0:5c4d7b2438d3 733 case UNITY_FLOAT_IS_INF:
switches 0:5c4d7b2438d3 734 case UNITY_FLOAT_IS_NOT_INF:
switches 0:5c4d7b2438d3 735 is_trait = isinf(actual) & ispos(actual);
switches 0:5c4d7b2438d3 736 break;
switches 0:5c4d7b2438d3 737 case UNITY_FLOAT_IS_NEG_INF:
switches 0:5c4d7b2438d3 738 case UNITY_FLOAT_IS_NOT_NEG_INF:
switches 0:5c4d7b2438d3 739 is_trait = isinf(actual) & isneg(actual);
switches 0:5c4d7b2438d3 740 break;
switches 0:5c4d7b2438d3 741
switches 0:5c4d7b2438d3 742 /* NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN. */
switches 0:5c4d7b2438d3 743 case UNITY_FLOAT_IS_NAN:
switches 0:5c4d7b2438d3 744 case UNITY_FLOAT_IS_NOT_NAN:
switches 0:5c4d7b2438d3 745 is_trait = isnan(actual);
switches 0:5c4d7b2438d3 746 break;
switches 0:5c4d7b2438d3 747
switches 0:5c4d7b2438d3 748 /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
switches 0:5c4d7b2438d3 749 case UNITY_FLOAT_IS_DET:
switches 0:5c4d7b2438d3 750 case UNITY_FLOAT_IS_NOT_DET:
switches 0:5c4d7b2438d3 751 if (isinf(actual) | isnan(actual))
switches 0:5c4d7b2438d3 752 is_trait = 0;
switches 0:5c4d7b2438d3 753 else
switches 0:5c4d7b2438d3 754 is_trait = 1;
switches 0:5c4d7b2438d3 755 break;
switches 0:5c4d7b2438d3 756
switches 0:5c4d7b2438d3 757 default:
switches 0:5c4d7b2438d3 758 trait_index = 0;
switches 0:5c4d7b2438d3 759 trait_names[0] = UnityStrInvalidFloatTrait;
switches 0:5c4d7b2438d3 760 break;
switches 0:5c4d7b2438d3 761 }
switches 0:5c4d7b2438d3 762
switches 0:5c4d7b2438d3 763 if (is_trait != should_be_trait)
switches 0:5c4d7b2438d3 764 {
switches 0:5c4d7b2438d3 765 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 766 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 767 if (!should_be_trait)
switches 0:5c4d7b2438d3 768 UnityPrint(UnityStrNot);
switches 0:5c4d7b2438d3 769 UnityPrint(trait_names[trait_index]);
switches 0:5c4d7b2438d3 770 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 771 #ifdef UNITY_FLOAT_VERBOSE
switches 0:5c4d7b2438d3 772 UnityPrintFloat(actual);
switches 0:5c4d7b2438d3 773 #else
switches 0:5c4d7b2438d3 774 if (should_be_trait)
switches 0:5c4d7b2438d3 775 UnityPrint(UnityStrNot);
switches 0:5c4d7b2438d3 776 UnityPrint(trait_names[trait_index]);
switches 0:5c4d7b2438d3 777 #endif
switches 0:5c4d7b2438d3 778 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 779 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 780 }
switches 0:5c4d7b2438d3 781 }
switches 0:5c4d7b2438d3 782
switches 0:5c4d7b2438d3 783 #endif /* not UNITY_EXCLUDE_FLOAT */
switches 0:5c4d7b2438d3 784
switches 0:5c4d7b2438d3 785 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 786 #ifndef UNITY_EXCLUDE_DOUBLE
switches 0:5c4d7b2438d3 787 void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
switches 0:5c4d7b2438d3 788 UNITY_PTR_ATTRIBUTE const _UD* actual,
switches 0:5c4d7b2438d3 789 const _UU32 num_elements,
switches 0:5c4d7b2438d3 790 const char* msg,
switches 0:5c4d7b2438d3 791 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 792 {
switches 0:5c4d7b2438d3 793 _UU32 elements = num_elements;
switches 0:5c4d7b2438d3 794 UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;
switches 0:5c4d7b2438d3 795 UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;
switches 0:5c4d7b2438d3 796 _UD diff, tol;
switches 0:5c4d7b2438d3 797
switches 0:5c4d7b2438d3 798 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 799
switches 0:5c4d7b2438d3 800 if (elements == 0)
switches 0:5c4d7b2438d3 801 {
switches 0:5c4d7b2438d3 802 UnityPrintPointlessAndBail();
switches 0:5c4d7b2438d3 803 }
switches 0:5c4d7b2438d3 804
switches 0:5c4d7b2438d3 805 if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
switches 0:5c4d7b2438d3 806 return;
switches 0:5c4d7b2438d3 807
switches 0:5c4d7b2438d3 808 while (elements--)
switches 0:5c4d7b2438d3 809 {
switches 0:5c4d7b2438d3 810 diff = *ptr_expected - *ptr_actual;
switches 0:5c4d7b2438d3 811 if (diff < 0.0)
switches 0:5c4d7b2438d3 812 diff = 0.0 - diff;
switches 0:5c4d7b2438d3 813 tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
switches 0:5c4d7b2438d3 814 if (tol < 0.0)
switches 0:5c4d7b2438d3 815 tol = 0.0 - tol;
switches 0:5c4d7b2438d3 816
switches 0:5c4d7b2438d3 817 /* This first part of this condition will catch any NaN or Infinite values */
switches 0:5c4d7b2438d3 818 if (isnan(diff) || isinf(diff) || (diff > tol))
switches 0:5c4d7b2438d3 819 {
switches 0:5c4d7b2438d3 820 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 821 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 822 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 823 #ifdef UNITY_DOUBLE_VERBOSE
switches 0:5c4d7b2438d3 824 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 825 UnityPrintFloat((float)(*ptr_expected));
switches 0:5c4d7b2438d3 826 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 827 UnityPrintFloat((float)(*ptr_actual));
switches 0:5c4d7b2438d3 828 #else
switches 0:5c4d7b2438d3 829 UnityPrint(UnityStrDelta);
switches 0:5c4d7b2438d3 830 #endif
switches 0:5c4d7b2438d3 831 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 832 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 833 }
switches 0:5c4d7b2438d3 834 ptr_expected++;
switches 0:5c4d7b2438d3 835 ptr_actual++;
switches 0:5c4d7b2438d3 836 }
switches 0:5c4d7b2438d3 837 }
switches 0:5c4d7b2438d3 838
switches 0:5c4d7b2438d3 839 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 840 void UnityAssertDoublesWithin(const _UD delta,
switches 0:5c4d7b2438d3 841 const _UD expected,
switches 0:5c4d7b2438d3 842 const _UD actual,
switches 0:5c4d7b2438d3 843 const char* msg,
switches 0:5c4d7b2438d3 844 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 845 {
switches 0:5c4d7b2438d3 846 _UD diff = actual - expected;
switches 0:5c4d7b2438d3 847 _UD pos_delta = delta;
switches 0:5c4d7b2438d3 848
switches 0:5c4d7b2438d3 849 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 850
switches 0:5c4d7b2438d3 851 if (diff < 0.0)
switches 0:5c4d7b2438d3 852 {
switches 0:5c4d7b2438d3 853 diff = 0.0 - diff;
switches 0:5c4d7b2438d3 854 }
switches 0:5c4d7b2438d3 855 if (pos_delta < 0.0)
switches 0:5c4d7b2438d3 856 {
switches 0:5c4d7b2438d3 857 pos_delta = 0.0 - pos_delta;
switches 0:5c4d7b2438d3 858 }
switches 0:5c4d7b2438d3 859
switches 0:5c4d7b2438d3 860 /* This first part of this condition will catch any NaN or Infinite values */
switches 0:5c4d7b2438d3 861 if (isnan(diff) || isinf(diff) || (pos_delta < diff))
switches 0:5c4d7b2438d3 862 {
switches 0:5c4d7b2438d3 863 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 864 #ifdef UNITY_DOUBLE_VERBOSE
switches 0:5c4d7b2438d3 865 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 866 UnityPrintFloat((float)expected);
switches 0:5c4d7b2438d3 867 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 868 UnityPrintFloat((float)actual);
switches 0:5c4d7b2438d3 869 #else
switches 0:5c4d7b2438d3 870 UnityPrint(UnityStrDelta);
switches 0:5c4d7b2438d3 871 #endif
switches 0:5c4d7b2438d3 872 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 873 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 874 }
switches 0:5c4d7b2438d3 875 }
switches 0:5c4d7b2438d3 876
switches 0:5c4d7b2438d3 877 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 878
switches 0:5c4d7b2438d3 879 void UnityAssertDoubleSpecial(const _UD actual,
switches 0:5c4d7b2438d3 880 const char* msg,
switches 0:5c4d7b2438d3 881 const UNITY_LINE_TYPE lineNumber,
switches 0:5c4d7b2438d3 882 const UNITY_FLOAT_TRAIT_T style)
switches 0:5c4d7b2438d3 883 {
switches 0:5c4d7b2438d3 884 const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
switches 0:5c4d7b2438d3 885 _U_SINT should_be_trait = ((_U_SINT)style & 1);
switches 0:5c4d7b2438d3 886 _U_SINT is_trait = !should_be_trait;
switches 0:5c4d7b2438d3 887 _U_SINT trait_index = (_U_SINT)(style >> 1);
switches 0:5c4d7b2438d3 888
switches 0:5c4d7b2438d3 889 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 890
switches 0:5c4d7b2438d3 891 switch(style)
switches 0:5c4d7b2438d3 892 {
switches 0:5c4d7b2438d3 893 /* To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
switches 0:5c4d7b2438d3 894 * We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise */
switches 0:5c4d7b2438d3 895 case UNITY_FLOAT_IS_INF:
switches 0:5c4d7b2438d3 896 case UNITY_FLOAT_IS_NOT_INF:
switches 0:5c4d7b2438d3 897 is_trait = isinf(actual) & ispos(actual);
switches 0:5c4d7b2438d3 898 break;
switches 0:5c4d7b2438d3 899 case UNITY_FLOAT_IS_NEG_INF:
switches 0:5c4d7b2438d3 900 case UNITY_FLOAT_IS_NOT_NEG_INF:
switches 0:5c4d7b2438d3 901 is_trait = isinf(actual) & isneg(actual);
switches 0:5c4d7b2438d3 902 break;
switches 0:5c4d7b2438d3 903
switches 0:5c4d7b2438d3 904 /* NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN. */
switches 0:5c4d7b2438d3 905 case UNITY_FLOAT_IS_NAN:
switches 0:5c4d7b2438d3 906 case UNITY_FLOAT_IS_NOT_NAN:
switches 0:5c4d7b2438d3 907 is_trait = isnan(actual);
switches 0:5c4d7b2438d3 908 break;
switches 0:5c4d7b2438d3 909
switches 0:5c4d7b2438d3 910 /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
switches 0:5c4d7b2438d3 911 case UNITY_FLOAT_IS_DET:
switches 0:5c4d7b2438d3 912 case UNITY_FLOAT_IS_NOT_DET:
switches 0:5c4d7b2438d3 913 if (isinf(actual) | isnan(actual))
switches 0:5c4d7b2438d3 914 is_trait = 0;
switches 0:5c4d7b2438d3 915 else
switches 0:5c4d7b2438d3 916 is_trait = 1;
switches 0:5c4d7b2438d3 917 break;
switches 0:5c4d7b2438d3 918
switches 0:5c4d7b2438d3 919 default:
switches 0:5c4d7b2438d3 920 trait_index = 0;
switches 0:5c4d7b2438d3 921 trait_names[0] = UnityStrInvalidFloatTrait;
switches 0:5c4d7b2438d3 922 break;
switches 0:5c4d7b2438d3 923 }
switches 0:5c4d7b2438d3 924
switches 0:5c4d7b2438d3 925 if (is_trait != should_be_trait)
switches 0:5c4d7b2438d3 926 {
switches 0:5c4d7b2438d3 927 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 928 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 929 if (!should_be_trait)
switches 0:5c4d7b2438d3 930 UnityPrint(UnityStrNot);
switches 0:5c4d7b2438d3 931 UnityPrint(trait_names[trait_index]);
switches 0:5c4d7b2438d3 932 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 933 #ifdef UNITY_DOUBLE_VERBOSE
switches 0:5c4d7b2438d3 934 UnityPrintFloat(actual);
switches 0:5c4d7b2438d3 935 #else
switches 0:5c4d7b2438d3 936 if (should_be_trait)
switches 0:5c4d7b2438d3 937 UnityPrint(UnityStrNot);
switches 0:5c4d7b2438d3 938 UnityPrint(trait_names[trait_index]);
switches 0:5c4d7b2438d3 939 #endif
switches 0:5c4d7b2438d3 940 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 941 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 942 }
switches 0:5c4d7b2438d3 943 }
switches 0:5c4d7b2438d3 944
switches 0:5c4d7b2438d3 945
switches 0:5c4d7b2438d3 946 #endif /* not UNITY_EXCLUDE_DOUBLE */
switches 0:5c4d7b2438d3 947
switches 0:5c4d7b2438d3 948 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 949 void UnityAssertNumbersWithin( const _U_UINT delta,
switches 0:5c4d7b2438d3 950 const _U_SINT expected,
switches 0:5c4d7b2438d3 951 const _U_SINT actual,
switches 0:5c4d7b2438d3 952 const char* msg,
switches 0:5c4d7b2438d3 953 const UNITY_LINE_TYPE lineNumber,
switches 0:5c4d7b2438d3 954 const UNITY_DISPLAY_STYLE_T style)
switches 0:5c4d7b2438d3 955 {
switches 0:5c4d7b2438d3 956 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 957
switches 0:5c4d7b2438d3 958 if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
switches 0:5c4d7b2438d3 959 {
switches 0:5c4d7b2438d3 960 if (actual > expected)
switches 0:5c4d7b2438d3 961 Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);
switches 0:5c4d7b2438d3 962 else
switches 0:5c4d7b2438d3 963 Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);
switches 0:5c4d7b2438d3 964 }
switches 0:5c4d7b2438d3 965 else
switches 0:5c4d7b2438d3 966 {
switches 0:5c4d7b2438d3 967 if ((_U_UINT)actual > (_U_UINT)expected)
switches 0:5c4d7b2438d3 968 Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);
switches 0:5c4d7b2438d3 969 else
switches 0:5c4d7b2438d3 970 Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);
switches 0:5c4d7b2438d3 971 }
switches 0:5c4d7b2438d3 972
switches 0:5c4d7b2438d3 973 if (Unity.CurrentTestFailed)
switches 0:5c4d7b2438d3 974 {
switches 0:5c4d7b2438d3 975 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 976 UnityPrint(UnityStrDelta);
switches 0:5c4d7b2438d3 977 UnityPrintNumberByStyle((_U_SINT)delta, style);
switches 0:5c4d7b2438d3 978 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 979 UnityPrintNumberByStyle(expected, style);
switches 0:5c4d7b2438d3 980 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 981 UnityPrintNumberByStyle(actual, style);
switches 0:5c4d7b2438d3 982 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 983 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 984 }
switches 0:5c4d7b2438d3 985 }
switches 0:5c4d7b2438d3 986
switches 0:5c4d7b2438d3 987 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 988 void UnityAssertEqualString(const char* expected,
switches 0:5c4d7b2438d3 989 const char* actual,
switches 0:5c4d7b2438d3 990 const char* msg,
switches 0:5c4d7b2438d3 991 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 992 {
switches 0:5c4d7b2438d3 993 _UU32 i;
switches 0:5c4d7b2438d3 994
switches 0:5c4d7b2438d3 995 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 996
switches 0:5c4d7b2438d3 997 /* if both pointers not null compare the strings */
switches 0:5c4d7b2438d3 998 if (expected && actual)
switches 0:5c4d7b2438d3 999 {
switches 0:5c4d7b2438d3 1000 for (i = 0; expected[i] || actual[i]; i++)
switches 0:5c4d7b2438d3 1001 {
switches 0:5c4d7b2438d3 1002 if (expected[i] != actual[i])
switches 0:5c4d7b2438d3 1003 {
switches 0:5c4d7b2438d3 1004 Unity.CurrentTestFailed = 1;
switches 0:5c4d7b2438d3 1005 break;
switches 0:5c4d7b2438d3 1006 }
switches 0:5c4d7b2438d3 1007 }
switches 0:5c4d7b2438d3 1008 }
switches 0:5c4d7b2438d3 1009 else
switches 0:5c4d7b2438d3 1010 { /* handle case of one pointers being null (if both null, test should pass) */
switches 0:5c4d7b2438d3 1011 if (expected != actual)
switches 0:5c4d7b2438d3 1012 {
switches 0:5c4d7b2438d3 1013 Unity.CurrentTestFailed = 1;
switches 0:5c4d7b2438d3 1014 }
switches 0:5c4d7b2438d3 1015 }
switches 0:5c4d7b2438d3 1016
switches 0:5c4d7b2438d3 1017 if (Unity.CurrentTestFailed)
switches 0:5c4d7b2438d3 1018 {
switches 0:5c4d7b2438d3 1019 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 1020 UnityPrintExpectedAndActualStrings(expected, actual);
switches 0:5c4d7b2438d3 1021 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 1022 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 1023 }
switches 0:5c4d7b2438d3 1024 }
switches 0:5c4d7b2438d3 1025
switches 0:5c4d7b2438d3 1026 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1027 void UnityAssertEqualStringLen(const char* expected,
switches 0:5c4d7b2438d3 1028 const char* actual,
switches 0:5c4d7b2438d3 1029 const _UU32 length,
switches 0:5c4d7b2438d3 1030 const char* msg,
switches 0:5c4d7b2438d3 1031 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 1032 {
switches 0:5c4d7b2438d3 1033 _UU32 i;
switches 0:5c4d7b2438d3 1034
switches 0:5c4d7b2438d3 1035 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 1036
switches 0:5c4d7b2438d3 1037 /* if both pointers not null compare the strings */
switches 0:5c4d7b2438d3 1038 if (expected && actual)
switches 0:5c4d7b2438d3 1039 {
switches 0:5c4d7b2438d3 1040 for (i = 0; (expected[i] || actual[i]) && i < length; i++)
switches 0:5c4d7b2438d3 1041 {
switches 0:5c4d7b2438d3 1042 if (expected[i] != actual[i])
switches 0:5c4d7b2438d3 1043 {
switches 0:5c4d7b2438d3 1044 Unity.CurrentTestFailed = 1;
switches 0:5c4d7b2438d3 1045 break;
switches 0:5c4d7b2438d3 1046 }
switches 0:5c4d7b2438d3 1047 }
switches 0:5c4d7b2438d3 1048 }
switches 0:5c4d7b2438d3 1049 else
switches 0:5c4d7b2438d3 1050 { /* handle case of one pointers being null (if both null, test should pass) */
switches 0:5c4d7b2438d3 1051 if (expected != actual)
switches 0:5c4d7b2438d3 1052 {
switches 0:5c4d7b2438d3 1053 Unity.CurrentTestFailed = 1;
switches 0:5c4d7b2438d3 1054 }
switches 0:5c4d7b2438d3 1055 }
switches 0:5c4d7b2438d3 1056
switches 0:5c4d7b2438d3 1057 if (Unity.CurrentTestFailed)
switches 0:5c4d7b2438d3 1058 {
switches 0:5c4d7b2438d3 1059 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 1060 UnityPrintExpectedAndActualStringsLen(expected, actual, length);
switches 0:5c4d7b2438d3 1061 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 1062 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 1063 }
switches 0:5c4d7b2438d3 1064 }
switches 0:5c4d7b2438d3 1065
switches 0:5c4d7b2438d3 1066
switches 0:5c4d7b2438d3 1067 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1068 void UnityAssertEqualStringArray( const char** expected,
switches 0:5c4d7b2438d3 1069 const char** actual,
switches 0:5c4d7b2438d3 1070 const _UU32 num_elements,
switches 0:5c4d7b2438d3 1071 const char* msg,
switches 0:5c4d7b2438d3 1072 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 1073 {
switches 0:5c4d7b2438d3 1074 _UU32 i, j = 0;
switches 0:5c4d7b2438d3 1075
switches 0:5c4d7b2438d3 1076 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 1077
switches 0:5c4d7b2438d3 1078 /* if no elements, it's an error */
switches 0:5c4d7b2438d3 1079 if (num_elements == 0)
switches 0:5c4d7b2438d3 1080 {
switches 0:5c4d7b2438d3 1081 UnityPrintPointlessAndBail();
switches 0:5c4d7b2438d3 1082 }
switches 0:5c4d7b2438d3 1083
switches 0:5c4d7b2438d3 1084 if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
switches 0:5c4d7b2438d3 1085 return;
switches 0:5c4d7b2438d3 1086
switches 0:5c4d7b2438d3 1087 do
switches 0:5c4d7b2438d3 1088 {
switches 0:5c4d7b2438d3 1089 /* if both pointers not null compare the strings */
switches 0:5c4d7b2438d3 1090 if (expected[j] && actual[j])
switches 0:5c4d7b2438d3 1091 {
switches 0:5c4d7b2438d3 1092 for (i = 0; expected[j][i] || actual[j][i]; i++)
switches 0:5c4d7b2438d3 1093 {
switches 0:5c4d7b2438d3 1094 if (expected[j][i] != actual[j][i])
switches 0:5c4d7b2438d3 1095 {
switches 0:5c4d7b2438d3 1096 Unity.CurrentTestFailed = 1;
switches 0:5c4d7b2438d3 1097 break;
switches 0:5c4d7b2438d3 1098 }
switches 0:5c4d7b2438d3 1099 }
switches 0:5c4d7b2438d3 1100 }
switches 0:5c4d7b2438d3 1101 else
switches 0:5c4d7b2438d3 1102 { /* handle case of one pointers being null (if both null, test should pass) */
switches 0:5c4d7b2438d3 1103 if (expected[j] != actual[j])
switches 0:5c4d7b2438d3 1104 {
switches 0:5c4d7b2438d3 1105 Unity.CurrentTestFailed = 1;
switches 0:5c4d7b2438d3 1106 }
switches 0:5c4d7b2438d3 1107 }
switches 0:5c4d7b2438d3 1108
switches 0:5c4d7b2438d3 1109 if (Unity.CurrentTestFailed)
switches 0:5c4d7b2438d3 1110 {
switches 0:5c4d7b2438d3 1111 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 1112 if (num_elements > 1)
switches 0:5c4d7b2438d3 1113 {
switches 0:5c4d7b2438d3 1114 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 1115 UnityPrintNumberUnsigned(j);
switches 0:5c4d7b2438d3 1116 }
switches 0:5c4d7b2438d3 1117 UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
switches 0:5c4d7b2438d3 1118 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 1119 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 1120 }
switches 0:5c4d7b2438d3 1121 } while (++j < num_elements);
switches 0:5c4d7b2438d3 1122 }
switches 0:5c4d7b2438d3 1123
switches 0:5c4d7b2438d3 1124 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1125 void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
switches 0:5c4d7b2438d3 1126 UNITY_INTERNAL_PTR actual,
switches 0:5c4d7b2438d3 1127 const _UU32 length,
switches 0:5c4d7b2438d3 1128 const _UU32 num_elements,
switches 0:5c4d7b2438d3 1129 const char* msg,
switches 0:5c4d7b2438d3 1130 const UNITY_LINE_TYPE lineNumber)
switches 0:5c4d7b2438d3 1131 {
switches 0:5c4d7b2438d3 1132 UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
switches 0:5c4d7b2438d3 1133 UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
switches 0:5c4d7b2438d3 1134 _UU32 elements = num_elements;
switches 0:5c4d7b2438d3 1135 _UU32 bytes;
switches 0:5c4d7b2438d3 1136
switches 0:5c4d7b2438d3 1137 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 1138
switches 0:5c4d7b2438d3 1139 if ((elements == 0) || (length == 0))
switches 0:5c4d7b2438d3 1140 {
switches 0:5c4d7b2438d3 1141 UnityPrintPointlessAndBail();
switches 0:5c4d7b2438d3 1142 }
switches 0:5c4d7b2438d3 1143
switches 0:5c4d7b2438d3 1144 if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
switches 0:5c4d7b2438d3 1145 return;
switches 0:5c4d7b2438d3 1146
switches 0:5c4d7b2438d3 1147 while (elements--)
switches 0:5c4d7b2438d3 1148 {
switches 0:5c4d7b2438d3 1149 /* /////////////////////////////////// */
switches 0:5c4d7b2438d3 1150 bytes = length;
switches 0:5c4d7b2438d3 1151 while (bytes--)
switches 0:5c4d7b2438d3 1152 {
switches 0:5c4d7b2438d3 1153 if (*ptr_exp != *ptr_act)
switches 0:5c4d7b2438d3 1154 {
switches 0:5c4d7b2438d3 1155 UnityTestResultsFailBegin(lineNumber);
switches 0:5c4d7b2438d3 1156 UnityPrint(UnityStrMemory);
switches 0:5c4d7b2438d3 1157 if (num_elements > 1)
switches 0:5c4d7b2438d3 1158 {
switches 0:5c4d7b2438d3 1159 UnityPrint(UnityStrElement);
switches 0:5c4d7b2438d3 1160 UnityPrintNumberUnsigned(num_elements - elements - 1);
switches 0:5c4d7b2438d3 1161 }
switches 0:5c4d7b2438d3 1162 UnityPrint(UnityStrByte);
switches 0:5c4d7b2438d3 1163 UnityPrintNumberUnsigned(length - bytes - 1);
switches 0:5c4d7b2438d3 1164 UnityPrint(UnityStrExpected);
switches 0:5c4d7b2438d3 1165 UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
switches 0:5c4d7b2438d3 1166 UnityPrint(UnityStrWas);
switches 0:5c4d7b2438d3 1167 UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
switches 0:5c4d7b2438d3 1168 UnityAddMsgIfSpecified(msg);
switches 0:5c4d7b2438d3 1169 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 1170 }
switches 0:5c4d7b2438d3 1171 ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
switches 0:5c4d7b2438d3 1172 ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
switches 0:5c4d7b2438d3 1173 }
switches 0:5c4d7b2438d3 1174 /* /////////////////////////////////// */
switches 0:5c4d7b2438d3 1175
switches 0:5c4d7b2438d3 1176 }
switches 0:5c4d7b2438d3 1177 }
switches 0:5c4d7b2438d3 1178
switches 0:5c4d7b2438d3 1179 /*-----------------------------------------------
switches 0:5c4d7b2438d3 1180 * Control Functions
switches 0:5c4d7b2438d3 1181 *-----------------------------------------------*/
switches 0:5c4d7b2438d3 1182
switches 0:5c4d7b2438d3 1183 void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
switches 0:5c4d7b2438d3 1184 {
switches 0:5c4d7b2438d3 1185 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 1186
switches 0:5c4d7b2438d3 1187 UnityTestResultsBegin(Unity.TestFile, line);
switches 0:5c4d7b2438d3 1188 UnityPrintFail();
switches 0:5c4d7b2438d3 1189 if (msg != NULL)
switches 0:5c4d7b2438d3 1190 {
switches 0:5c4d7b2438d3 1191 UNITY_OUTPUT_CHAR(':');
switches 0:5c4d7b2438d3 1192
switches 0:5c4d7b2438d3 1193 #ifndef UNITY_EXCLUDE_DETAILS
switches 0:5c4d7b2438d3 1194 if (Unity.CurrentDetail1)
switches 0:5c4d7b2438d3 1195 {
switches 0:5c4d7b2438d3 1196 UnityPrint(UnityStrDetail1Name);
switches 0:5c4d7b2438d3 1197 UnityPrint(Unity.CurrentDetail1);
switches 0:5c4d7b2438d3 1198 if (Unity.CurrentDetail2)
switches 0:5c4d7b2438d3 1199 {
switches 0:5c4d7b2438d3 1200 UnityPrint(UnityStrDetail2Name);
switches 0:5c4d7b2438d3 1201 UnityPrint(Unity.CurrentDetail2);
switches 0:5c4d7b2438d3 1202 }
switches 0:5c4d7b2438d3 1203 UnityPrint(UnityStrSpacer);
switches 0:5c4d7b2438d3 1204 }
switches 0:5c4d7b2438d3 1205 #endif
switches 0:5c4d7b2438d3 1206 if (msg[0] != ' ')
switches 0:5c4d7b2438d3 1207 {
switches 0:5c4d7b2438d3 1208 UNITY_OUTPUT_CHAR(' ');
switches 0:5c4d7b2438d3 1209 }
switches 0:5c4d7b2438d3 1210 UnityPrint(msg);
switches 0:5c4d7b2438d3 1211 }
switches 0:5c4d7b2438d3 1212 UNITY_FAIL_AND_BAIL;
switches 0:5c4d7b2438d3 1213 }
switches 0:5c4d7b2438d3 1214
switches 0:5c4d7b2438d3 1215 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1216 void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
switches 0:5c4d7b2438d3 1217 {
switches 0:5c4d7b2438d3 1218 UNITY_SKIP_EXECUTION;
switches 0:5c4d7b2438d3 1219
switches 0:5c4d7b2438d3 1220 UnityTestResultsBegin(Unity.TestFile, line);
switches 0:5c4d7b2438d3 1221 UnityPrint(UnityStrIgnore);
switches 0:5c4d7b2438d3 1222 if (msg != NULL)
switches 0:5c4d7b2438d3 1223 {
switches 0:5c4d7b2438d3 1224 UNITY_OUTPUT_CHAR(':');
switches 0:5c4d7b2438d3 1225 UNITY_OUTPUT_CHAR(' ');
switches 0:5c4d7b2438d3 1226 UnityPrint(msg);
switches 0:5c4d7b2438d3 1227 }
switches 0:5c4d7b2438d3 1228 UNITY_IGNORE_AND_BAIL;
switches 0:5c4d7b2438d3 1229 }
switches 0:5c4d7b2438d3 1230
switches 0:5c4d7b2438d3 1231 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1232 #if defined(UNITY_WEAK_ATTRIBUTE)
switches 0:5c4d7b2438d3 1233 UNITY_WEAK_ATTRIBUTE void setUp(void) { }
switches 0:5c4d7b2438d3 1234 UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
switches 0:5c4d7b2438d3 1235 #elif defined(UNITY_WEAK_PRAGMA)
switches 0:5c4d7b2438d3 1236 # pragma weak setUp
switches 0:5c4d7b2438d3 1237 void setUp(void) { }
switches 0:5c4d7b2438d3 1238 # pragma weak tearDown
switches 0:5c4d7b2438d3 1239 void tearDown(void) { }
switches 0:5c4d7b2438d3 1240 #endif
switches 0:5c4d7b2438d3 1241 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1242 void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
switches 0:5c4d7b2438d3 1243 {
switches 0:5c4d7b2438d3 1244 Unity.CurrentTestName = FuncName;
switches 0:5c4d7b2438d3 1245 Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
switches 0:5c4d7b2438d3 1246 Unity.NumberOfTests++;
switches 0:5c4d7b2438d3 1247 UNITY_CLR_DETAILS();
switches 0:5c4d7b2438d3 1248 if (TEST_PROTECT())
switches 0:5c4d7b2438d3 1249 {
switches 0:5c4d7b2438d3 1250 setUp();
switches 0:5c4d7b2438d3 1251 Func();
switches 0:5c4d7b2438d3 1252 }
switches 0:5c4d7b2438d3 1253 if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
switches 0:5c4d7b2438d3 1254 {
switches 0:5c4d7b2438d3 1255 tearDown();
switches 0:5c4d7b2438d3 1256 }
switches 0:5c4d7b2438d3 1257 UnityConcludeTest();
switches 0:5c4d7b2438d3 1258 }
switches 0:5c4d7b2438d3 1259
switches 0:5c4d7b2438d3 1260 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1261 void UnityBegin(const char* filename)
switches 0:5c4d7b2438d3 1262 {
switches 0:5c4d7b2438d3 1263 Unity.TestFile = filename;
switches 0:5c4d7b2438d3 1264 Unity.CurrentTestName = NULL;
switches 0:5c4d7b2438d3 1265 Unity.CurrentTestLineNumber = 0;
switches 0:5c4d7b2438d3 1266 Unity.NumberOfTests = 0;
switches 0:5c4d7b2438d3 1267 Unity.TestFailures = 0;
switches 0:5c4d7b2438d3 1268 Unity.TestIgnores = 0;
switches 0:5c4d7b2438d3 1269 Unity.CurrentTestFailed = 0;
switches 0:5c4d7b2438d3 1270 Unity.CurrentTestIgnored = 0;
switches 0:5c4d7b2438d3 1271
switches 0:5c4d7b2438d3 1272 UNITY_CLR_DETAILS();
switches 0:5c4d7b2438d3 1273 UNITY_OUTPUT_START();
switches 0:5c4d7b2438d3 1274 }
switches 0:5c4d7b2438d3 1275
switches 0:5c4d7b2438d3 1276 /*-----------------------------------------------*/
switches 0:5c4d7b2438d3 1277 int UnityEnd(void)
switches 0:5c4d7b2438d3 1278 {
switches 0:5c4d7b2438d3 1279 UNITY_PRINT_EOL();
switches 0:5c4d7b2438d3 1280 UnityPrint(UnityStrBreaker);
switches 0:5c4d7b2438d3 1281 UNITY_PRINT_EOL();
switches 0:5c4d7b2438d3 1282 UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));
switches 0:5c4d7b2438d3 1283 UnityPrint(UnityStrResultsTests);
switches 0:5c4d7b2438d3 1284 UnityPrintNumber((_U_SINT)(Unity.TestFailures));
switches 0:5c4d7b2438d3 1285 UnityPrint(UnityStrResultsFailures);
switches 0:5c4d7b2438d3 1286 UnityPrintNumber((_U_SINT)(Unity.TestIgnores));
switches 0:5c4d7b2438d3 1287 UnityPrint(UnityStrResultsIgnored);
switches 0:5c4d7b2438d3 1288 UNITY_PRINT_EOL();
switches 0:5c4d7b2438d3 1289 if (Unity.TestFailures == 0U)
switches 0:5c4d7b2438d3 1290 {
switches 0:5c4d7b2438d3 1291 UnityPrintOk();
switches 0:5c4d7b2438d3 1292 }
switches 0:5c4d7b2438d3 1293 else
switches 0:5c4d7b2438d3 1294 {
switches 0:5c4d7b2438d3 1295 UnityPrintFail();
switches 0:5c4d7b2438d3 1296 #ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
switches 0:5c4d7b2438d3 1297 UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
switches 0:5c4d7b2438d3 1298 #endif
switches 0:5c4d7b2438d3 1299 }
switches 0:5c4d7b2438d3 1300 UNITY_PRINT_EOL();
switches 0:5c4d7b2438d3 1301 UNITY_OUTPUT_FLUSH();
switches 0:5c4d7b2438d3 1302 UNITY_OUTPUT_COMPLETE();
switches 0:5c4d7b2438d3 1303 return (int)(Unity.TestFailures);
switches 0:5c4d7b2438d3 1304 }
switches 0:5c4d7b2438d3 1305
switches 0:5c4d7b2438d3 1306 /*-----------------------------------------------*/