Committer:
leothedragon
Date:
Sun Apr 18 15:20:23 2021 +0000
Revision:
0:25fa8795676b
DS

Who changed what in which revision?

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