Example

Dependencies:   FXAS21002 FXOS8700Q

Committer:
maygup01
Date:
Tue Nov 19 09:49:38 2019 +0000
Revision:
0:11cc2b7889af
Example

Who changed what in which revision?

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