Ram Gandikota
/
IOTMetronome
FRDM K64F Metronome
pal/Test/Unity/test/tests/testunity.c@0:dbad57390bd1, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:37:05 2017 +0000
- Revision:
- 0:dbad57390bd1
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:dbad57390bd1 | 1 | /* ========================================== |
ram54288 | 0:dbad57390bd1 | 2 | Unity Project - A Test Framework for C |
ram54288 | 0:dbad57390bd1 | 3 | Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams |
ram54288 | 0:dbad57390bd1 | 4 | [Released under MIT License. Please refer to license.txt for details] |
ram54288 | 0:dbad57390bd1 | 5 | ========================================== */ |
ram54288 | 0:dbad57390bd1 | 6 | |
ram54288 | 0:dbad57390bd1 | 7 | #include <setjmp.h> |
ram54288 | 0:dbad57390bd1 | 8 | #include "unity.h" |
ram54288 | 0:dbad57390bd1 | 9 | #include <string.h> |
ram54288 | 0:dbad57390bd1 | 10 | |
ram54288 | 0:dbad57390bd1 | 11 | // Dividing by these constants produces +/- infinity. |
ram54288 | 0:dbad57390bd1 | 12 | // The rationale is given in UnityAssertFloatIsInf's body. |
ram54288 | 0:dbad57390bd1 | 13 | #ifndef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 14 | static const _UF f_zero = 0.0f; |
ram54288 | 0:dbad57390bd1 | 15 | #endif |
ram54288 | 0:dbad57390bd1 | 16 | |
ram54288 | 0:dbad57390bd1 | 17 | #ifndef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 18 | static const _UD d_zero = 0.0; |
ram54288 | 0:dbad57390bd1 | 19 | #endif |
ram54288 | 0:dbad57390bd1 | 20 | |
ram54288 | 0:dbad57390bd1 | 21 | #define EXPECT_ABORT_BEGIN \ |
ram54288 | 0:dbad57390bd1 | 22 | if (TEST_PROTECT()) \ |
ram54288 | 0:dbad57390bd1 | 23 | { |
ram54288 | 0:dbad57390bd1 | 24 | |
ram54288 | 0:dbad57390bd1 | 25 | #define VERIFY_FAILS_END \ |
ram54288 | 0:dbad57390bd1 | 26 | } \ |
ram54288 | 0:dbad57390bd1 | 27 | Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ |
ram54288 | 0:dbad57390bd1 | 28 | if (Unity.CurrentTestFailed == 1) { \ |
ram54288 | 0:dbad57390bd1 | 29 | SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ |
ram54288 | 0:dbad57390bd1 | 30 | UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \ |
ram54288 | 0:dbad57390bd1 | 31 | UNITY_OUTPUT_CHAR(':'); \ |
ram54288 | 0:dbad57390bd1 | 32 | UnityPrint(Unity.CurrentTestName); \ |
ram54288 | 0:dbad57390bd1 | 33 | UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \ |
ram54288 | 0:dbad57390bd1 | 34 | UNITY_OUTPUT_CHAR('\n'); \ |
ram54288 | 0:dbad57390bd1 | 35 | } |
ram54288 | 0:dbad57390bd1 | 36 | |
ram54288 | 0:dbad57390bd1 | 37 | #define VERIFY_IGNORES_END \ |
ram54288 | 0:dbad57390bd1 | 38 | } \ |
ram54288 | 0:dbad57390bd1 | 39 | Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ |
ram54288 | 0:dbad57390bd1 | 40 | Unity.CurrentTestIgnored = 0; \ |
ram54288 | 0:dbad57390bd1 | 41 | if (Unity.CurrentTestFailed == 1) { \ |
ram54288 | 0:dbad57390bd1 | 42 | SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ |
ram54288 | 0:dbad57390bd1 | 43 | UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \ |
ram54288 | 0:dbad57390bd1 | 44 | UNITY_OUTPUT_CHAR('\n'); \ |
ram54288 | 0:dbad57390bd1 | 45 | } |
ram54288 | 0:dbad57390bd1 | 46 | |
ram54288 | 0:dbad57390bd1 | 47 | static int SetToOneToFailInTearDown; |
ram54288 | 0:dbad57390bd1 | 48 | static int SetToOneMeanWeAlreadyCheckedThisGuy; |
ram54288 | 0:dbad57390bd1 | 49 | |
ram54288 | 0:dbad57390bd1 | 50 | void setUp(void) |
ram54288 | 0:dbad57390bd1 | 51 | { |
ram54288 | 0:dbad57390bd1 | 52 | SetToOneToFailInTearDown = 0; |
ram54288 | 0:dbad57390bd1 | 53 | SetToOneMeanWeAlreadyCheckedThisGuy = 0; |
ram54288 | 0:dbad57390bd1 | 54 | } |
ram54288 | 0:dbad57390bd1 | 55 | |
ram54288 | 0:dbad57390bd1 | 56 | void tearDown(void) |
ram54288 | 0:dbad57390bd1 | 57 | { |
ram54288 | 0:dbad57390bd1 | 58 | if (SetToOneToFailInTearDown == 1) |
ram54288 | 0:dbad57390bd1 | 59 | TEST_FAIL_MESSAGE("<= Failed in tearDown"); |
ram54288 | 0:dbad57390bd1 | 60 | if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) |
ram54288 | 0:dbad57390bd1 | 61 | { |
ram54288 | 0:dbad57390bd1 | 62 | UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]"); |
ram54288 | 0:dbad57390bd1 | 63 | UNITY_OUTPUT_CHAR('\n'); |
ram54288 | 0:dbad57390bd1 | 64 | } |
ram54288 | 0:dbad57390bd1 | 65 | } |
ram54288 | 0:dbad57390bd1 | 66 | |
ram54288 | 0:dbad57390bd1 | 67 | void testUnitySizeInitializationReminder(void) |
ram54288 | 0:dbad57390bd1 | 68 | { |
ram54288 | 0:dbad57390bd1 | 69 | /* This test ensures that sizeof(struct _Unity) doesn't change. If this |
ram54288 | 0:dbad57390bd1 | 70 | * test breaks, go look at the initialization of the Unity global variable |
ram54288 | 0:dbad57390bd1 | 71 | * in unity.c and make sure we're filling in the proper fields. */ |
ram54288 | 0:dbad57390bd1 | 72 | const char* message = "Unexpected size for _Unity struct. Please check that " |
ram54288 | 0:dbad57390bd1 | 73 | "the initialization of the Unity symbol in unity.c is " |
ram54288 | 0:dbad57390bd1 | 74 | "still correct."; |
ram54288 | 0:dbad57390bd1 | 75 | |
ram54288 | 0:dbad57390bd1 | 76 | /* Define a structure with all the same fields as `struct _Unity`. */ |
ram54288 | 0:dbad57390bd1 | 77 | #ifdef UNITY_EXCLUDE_DETAILS |
ram54288 | 0:dbad57390bd1 | 78 | struct { |
ram54288 | 0:dbad57390bd1 | 79 | const char* TestFile; |
ram54288 | 0:dbad57390bd1 | 80 | const char* CurrentTestName; |
ram54288 | 0:dbad57390bd1 | 81 | UNITY_LINE_TYPE CurrentTestLineNumber; |
ram54288 | 0:dbad57390bd1 | 82 | UNITY_COUNTER_TYPE NumberOfTests; |
ram54288 | 0:dbad57390bd1 | 83 | UNITY_COUNTER_TYPE TestFailures; |
ram54288 | 0:dbad57390bd1 | 84 | UNITY_COUNTER_TYPE TestIgnores; |
ram54288 | 0:dbad57390bd1 | 85 | UNITY_COUNTER_TYPE CurrentTestFailed; |
ram54288 | 0:dbad57390bd1 | 86 | UNITY_COUNTER_TYPE CurrentTestIgnored; |
ram54288 | 0:dbad57390bd1 | 87 | jmp_buf AbortFrame; |
ram54288 | 0:dbad57390bd1 | 88 | } _Expected_Unity; |
ram54288 | 0:dbad57390bd1 | 89 | #else |
ram54288 | 0:dbad57390bd1 | 90 | struct { |
ram54288 | 0:dbad57390bd1 | 91 | const char* TestFile; |
ram54288 | 0:dbad57390bd1 | 92 | const char* CurrentTestName; |
ram54288 | 0:dbad57390bd1 | 93 | const char* CurrentDetails1; |
ram54288 | 0:dbad57390bd1 | 94 | const char* CurrentDetails2; |
ram54288 | 0:dbad57390bd1 | 95 | UNITY_LINE_TYPE CurrentTestLineNumber; |
ram54288 | 0:dbad57390bd1 | 96 | UNITY_COUNTER_TYPE NumberOfTests; |
ram54288 | 0:dbad57390bd1 | 97 | UNITY_COUNTER_TYPE TestFailures; |
ram54288 | 0:dbad57390bd1 | 98 | UNITY_COUNTER_TYPE TestIgnores; |
ram54288 | 0:dbad57390bd1 | 99 | UNITY_COUNTER_TYPE CurrentTestFailed; |
ram54288 | 0:dbad57390bd1 | 100 | UNITY_COUNTER_TYPE CurrentTestIgnored; |
ram54288 | 0:dbad57390bd1 | 101 | jmp_buf AbortFrame; |
ram54288 | 0:dbad57390bd1 | 102 | } _Expected_Unity; |
ram54288 | 0:dbad57390bd1 | 103 | #endif |
ram54288 | 0:dbad57390bd1 | 104 | |
ram54288 | 0:dbad57390bd1 | 105 | /* Compare our fake structure's size to the actual structure's size. They |
ram54288 | 0:dbad57390bd1 | 106 | * should be the same. |
ram54288 | 0:dbad57390bd1 | 107 | * |
ram54288 | 0:dbad57390bd1 | 108 | * This accounts for alignment, padding, and packing issues that might come |
ram54288 | 0:dbad57390bd1 | 109 | * up between different architectures. */ |
ram54288 | 0:dbad57390bd1 | 110 | TEST_ASSERT_EQUAL_MESSAGE(sizeof(_Expected_Unity), sizeof(Unity), message); |
ram54288 | 0:dbad57390bd1 | 111 | } |
ram54288 | 0:dbad57390bd1 | 112 | |
ram54288 | 0:dbad57390bd1 | 113 | void testPassShouldEndImmediatelyWithPass(void) |
ram54288 | 0:dbad57390bd1 | 114 | { |
ram54288 | 0:dbad57390bd1 | 115 | TEST_PASS(); |
ram54288 | 0:dbad57390bd1 | 116 | TEST_FAIL_MESSAGE("We should have passed already and finished this test"); |
ram54288 | 0:dbad57390bd1 | 117 | } |
ram54288 | 0:dbad57390bd1 | 118 | |
ram54288 | 0:dbad57390bd1 | 119 | void testTrue(void) |
ram54288 | 0:dbad57390bd1 | 120 | { |
ram54288 | 0:dbad57390bd1 | 121 | TEST_ASSERT(1); |
ram54288 | 0:dbad57390bd1 | 122 | |
ram54288 | 0:dbad57390bd1 | 123 | TEST_ASSERT_TRUE(1); |
ram54288 | 0:dbad57390bd1 | 124 | } |
ram54288 | 0:dbad57390bd1 | 125 | |
ram54288 | 0:dbad57390bd1 | 126 | void testFalse(void) |
ram54288 | 0:dbad57390bd1 | 127 | { |
ram54288 | 0:dbad57390bd1 | 128 | TEST_ASSERT_FALSE(0); |
ram54288 | 0:dbad57390bd1 | 129 | |
ram54288 | 0:dbad57390bd1 | 130 | TEST_ASSERT_UNLESS(0); |
ram54288 | 0:dbad57390bd1 | 131 | } |
ram54288 | 0:dbad57390bd1 | 132 | |
ram54288 | 0:dbad57390bd1 | 133 | void testPreviousPass(void) |
ram54288 | 0:dbad57390bd1 | 134 | { |
ram54288 | 0:dbad57390bd1 | 135 | TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); |
ram54288 | 0:dbad57390bd1 | 136 | } |
ram54288 | 0:dbad57390bd1 | 137 | |
ram54288 | 0:dbad57390bd1 | 138 | void testNotVanilla(void) |
ram54288 | 0:dbad57390bd1 | 139 | { |
ram54288 | 0:dbad57390bd1 | 140 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 141 | TEST_ASSERT(0); |
ram54288 | 0:dbad57390bd1 | 142 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 143 | } |
ram54288 | 0:dbad57390bd1 | 144 | |
ram54288 | 0:dbad57390bd1 | 145 | void testNotTrue(void) |
ram54288 | 0:dbad57390bd1 | 146 | { |
ram54288 | 0:dbad57390bd1 | 147 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 148 | TEST_ASSERT_TRUE(0); |
ram54288 | 0:dbad57390bd1 | 149 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 150 | } |
ram54288 | 0:dbad57390bd1 | 151 | |
ram54288 | 0:dbad57390bd1 | 152 | void testNotFalse(void) |
ram54288 | 0:dbad57390bd1 | 153 | { |
ram54288 | 0:dbad57390bd1 | 154 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 155 | TEST_ASSERT_FALSE(1); |
ram54288 | 0:dbad57390bd1 | 156 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 157 | } |
ram54288 | 0:dbad57390bd1 | 158 | |
ram54288 | 0:dbad57390bd1 | 159 | void testNotUnless(void) |
ram54288 | 0:dbad57390bd1 | 160 | { |
ram54288 | 0:dbad57390bd1 | 161 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 162 | TEST_ASSERT_UNLESS(1); |
ram54288 | 0:dbad57390bd1 | 163 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 164 | } |
ram54288 | 0:dbad57390bd1 | 165 | |
ram54288 | 0:dbad57390bd1 | 166 | void testNotNotEqual(void) |
ram54288 | 0:dbad57390bd1 | 167 | { |
ram54288 | 0:dbad57390bd1 | 168 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 169 | TEST_ASSERT_NOT_EQUAL(10, 10); |
ram54288 | 0:dbad57390bd1 | 170 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 171 | } |
ram54288 | 0:dbad57390bd1 | 172 | |
ram54288 | 0:dbad57390bd1 | 173 | void testFail(void) |
ram54288 | 0:dbad57390bd1 | 174 | { |
ram54288 | 0:dbad57390bd1 | 175 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 176 | TEST_FAIL_MESSAGE("Expected for testing"); |
ram54288 | 0:dbad57390bd1 | 177 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 178 | } |
ram54288 | 0:dbad57390bd1 | 179 | |
ram54288 | 0:dbad57390bd1 | 180 | void testIsNull(void) |
ram54288 | 0:dbad57390bd1 | 181 | { |
ram54288 | 0:dbad57390bd1 | 182 | char* ptr1 = NULL; |
ram54288 | 0:dbad57390bd1 | 183 | const char* ptr2 = "hello"; |
ram54288 | 0:dbad57390bd1 | 184 | |
ram54288 | 0:dbad57390bd1 | 185 | TEST_ASSERT_NULL(ptr1); |
ram54288 | 0:dbad57390bd1 | 186 | TEST_ASSERT_NOT_NULL(ptr2); |
ram54288 | 0:dbad57390bd1 | 187 | } |
ram54288 | 0:dbad57390bd1 | 188 | |
ram54288 | 0:dbad57390bd1 | 189 | void testIsNullShouldFailIfNot(void) |
ram54288 | 0:dbad57390bd1 | 190 | { |
ram54288 | 0:dbad57390bd1 | 191 | const char* ptr1 = "hello"; |
ram54288 | 0:dbad57390bd1 | 192 | |
ram54288 | 0:dbad57390bd1 | 193 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 194 | TEST_ASSERT_NULL(ptr1); |
ram54288 | 0:dbad57390bd1 | 195 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 196 | } |
ram54288 | 0:dbad57390bd1 | 197 | |
ram54288 | 0:dbad57390bd1 | 198 | void testNotNullShouldFailIfNULL(void) |
ram54288 | 0:dbad57390bd1 | 199 | { |
ram54288 | 0:dbad57390bd1 | 200 | char* ptr1 = NULL; |
ram54288 | 0:dbad57390bd1 | 201 | |
ram54288 | 0:dbad57390bd1 | 202 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 203 | TEST_ASSERT_NOT_NULL(ptr1); |
ram54288 | 0:dbad57390bd1 | 204 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 205 | } |
ram54288 | 0:dbad57390bd1 | 206 | |
ram54288 | 0:dbad57390bd1 | 207 | void testIgnore(void) |
ram54288 | 0:dbad57390bd1 | 208 | { |
ram54288 | 0:dbad57390bd1 | 209 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 210 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 211 | TEST_FAIL_MESSAGE("This should not be reached"); |
ram54288 | 0:dbad57390bd1 | 212 | VERIFY_IGNORES_END |
ram54288 | 0:dbad57390bd1 | 213 | } |
ram54288 | 0:dbad57390bd1 | 214 | |
ram54288 | 0:dbad57390bd1 | 215 | void testIgnoreMessage(void) |
ram54288 | 0:dbad57390bd1 | 216 | { |
ram54288 | 0:dbad57390bd1 | 217 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 218 | TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); |
ram54288 | 0:dbad57390bd1 | 219 | TEST_FAIL_MESSAGE("This should not be reached"); |
ram54288 | 0:dbad57390bd1 | 220 | VERIFY_IGNORES_END |
ram54288 | 0:dbad57390bd1 | 221 | } |
ram54288 | 0:dbad57390bd1 | 222 | |
ram54288 | 0:dbad57390bd1 | 223 | void testNotEqualInts(void) |
ram54288 | 0:dbad57390bd1 | 224 | { |
ram54288 | 0:dbad57390bd1 | 225 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 226 | TEST_ASSERT_EQUAL_INT(3982, 3983); |
ram54288 | 0:dbad57390bd1 | 227 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 228 | } |
ram54288 | 0:dbad57390bd1 | 229 | |
ram54288 | 0:dbad57390bd1 | 230 | void testNotEqualInt8s(void) |
ram54288 | 0:dbad57390bd1 | 231 | { |
ram54288 | 0:dbad57390bd1 | 232 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 233 | TEST_ASSERT_EQUAL_INT8(-127, -126); |
ram54288 | 0:dbad57390bd1 | 234 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 235 | } |
ram54288 | 0:dbad57390bd1 | 236 | |
ram54288 | 0:dbad57390bd1 | 237 | void testNotEqualInt16s(void) |
ram54288 | 0:dbad57390bd1 | 238 | { |
ram54288 | 0:dbad57390bd1 | 239 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 240 | TEST_ASSERT_EQUAL_INT16(-16383, -16382); |
ram54288 | 0:dbad57390bd1 | 241 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 242 | } |
ram54288 | 0:dbad57390bd1 | 243 | |
ram54288 | 0:dbad57390bd1 | 244 | void testNotEqualInt32s(void) |
ram54288 | 0:dbad57390bd1 | 245 | { |
ram54288 | 0:dbad57390bd1 | 246 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 247 | TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483648); //use largest 32 bit negative to test printability |
ram54288 | 0:dbad57390bd1 | 248 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 249 | } |
ram54288 | 0:dbad57390bd1 | 250 | |
ram54288 | 0:dbad57390bd1 | 251 | void testNotEqualBits(void) |
ram54288 | 0:dbad57390bd1 | 252 | { |
ram54288 | 0:dbad57390bd1 | 253 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 254 | TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); |
ram54288 | 0:dbad57390bd1 | 255 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 256 | } |
ram54288 | 0:dbad57390bd1 | 257 | |
ram54288 | 0:dbad57390bd1 | 258 | void testNotEqualUInts(void) |
ram54288 | 0:dbad57390bd1 | 259 | { |
ram54288 | 0:dbad57390bd1 | 260 | _UU16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 261 | |
ram54288 | 0:dbad57390bd1 | 262 | v0 = 9000; |
ram54288 | 0:dbad57390bd1 | 263 | v1 = 9001; |
ram54288 | 0:dbad57390bd1 | 264 | |
ram54288 | 0:dbad57390bd1 | 265 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 266 | TEST_ASSERT_EQUAL_UINT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 267 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 268 | } |
ram54288 | 0:dbad57390bd1 | 269 | |
ram54288 | 0:dbad57390bd1 | 270 | void testNotEqualUInt8s(void) |
ram54288 | 0:dbad57390bd1 | 271 | { |
ram54288 | 0:dbad57390bd1 | 272 | _UU8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 273 | |
ram54288 | 0:dbad57390bd1 | 274 | v0 = 254; |
ram54288 | 0:dbad57390bd1 | 275 | v1 = 255; |
ram54288 | 0:dbad57390bd1 | 276 | |
ram54288 | 0:dbad57390bd1 | 277 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 278 | TEST_ASSERT_EQUAL_UINT8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 279 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 280 | } |
ram54288 | 0:dbad57390bd1 | 281 | |
ram54288 | 0:dbad57390bd1 | 282 | void testNotEqualUInt16s(void) |
ram54288 | 0:dbad57390bd1 | 283 | { |
ram54288 | 0:dbad57390bd1 | 284 | _UU16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 285 | |
ram54288 | 0:dbad57390bd1 | 286 | v0 = 65535; |
ram54288 | 0:dbad57390bd1 | 287 | v1 = 65534; |
ram54288 | 0:dbad57390bd1 | 288 | |
ram54288 | 0:dbad57390bd1 | 289 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 290 | TEST_ASSERT_EQUAL_UINT16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 291 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 292 | } |
ram54288 | 0:dbad57390bd1 | 293 | |
ram54288 | 0:dbad57390bd1 | 294 | void testNotEqualUInt32s(void) |
ram54288 | 0:dbad57390bd1 | 295 | { |
ram54288 | 0:dbad57390bd1 | 296 | _UU32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 297 | |
ram54288 | 0:dbad57390bd1 | 298 | v0 = 4294967295; |
ram54288 | 0:dbad57390bd1 | 299 | v1 = 4294967294; |
ram54288 | 0:dbad57390bd1 | 300 | |
ram54288 | 0:dbad57390bd1 | 301 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 302 | TEST_ASSERT_EQUAL_UINT32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 303 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 304 | } |
ram54288 | 0:dbad57390bd1 | 305 | |
ram54288 | 0:dbad57390bd1 | 306 | void testNotEqualHex8s(void) |
ram54288 | 0:dbad57390bd1 | 307 | { |
ram54288 | 0:dbad57390bd1 | 308 | _UU8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 309 | |
ram54288 | 0:dbad57390bd1 | 310 | v0 = 0x23; |
ram54288 | 0:dbad57390bd1 | 311 | v1 = 0x22; |
ram54288 | 0:dbad57390bd1 | 312 | |
ram54288 | 0:dbad57390bd1 | 313 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 314 | TEST_ASSERT_EQUAL_HEX8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 315 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 316 | } |
ram54288 | 0:dbad57390bd1 | 317 | |
ram54288 | 0:dbad57390bd1 | 318 | void testNotEqualHex8sIfSigned(void) |
ram54288 | 0:dbad57390bd1 | 319 | { |
ram54288 | 0:dbad57390bd1 | 320 | _US8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 321 | |
ram54288 | 0:dbad57390bd1 | 322 | v0 = -2; |
ram54288 | 0:dbad57390bd1 | 323 | v1 = 2; |
ram54288 | 0:dbad57390bd1 | 324 | |
ram54288 | 0:dbad57390bd1 | 325 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 326 | TEST_ASSERT_EQUAL_HEX8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 327 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 328 | } |
ram54288 | 0:dbad57390bd1 | 329 | |
ram54288 | 0:dbad57390bd1 | 330 | void testNotEqualHex16s(void) |
ram54288 | 0:dbad57390bd1 | 331 | { |
ram54288 | 0:dbad57390bd1 | 332 | _UU16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 333 | |
ram54288 | 0:dbad57390bd1 | 334 | v0 = 0x1234; |
ram54288 | 0:dbad57390bd1 | 335 | v1 = 0x1235; |
ram54288 | 0:dbad57390bd1 | 336 | |
ram54288 | 0:dbad57390bd1 | 337 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 338 | TEST_ASSERT_EQUAL_HEX16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 339 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 340 | } |
ram54288 | 0:dbad57390bd1 | 341 | |
ram54288 | 0:dbad57390bd1 | 342 | void testNotEqualHex16sIfSigned(void) |
ram54288 | 0:dbad57390bd1 | 343 | { |
ram54288 | 0:dbad57390bd1 | 344 | _US16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 345 | |
ram54288 | 0:dbad57390bd1 | 346 | v0 = -1024; |
ram54288 | 0:dbad57390bd1 | 347 | v1 = -1028; |
ram54288 | 0:dbad57390bd1 | 348 | |
ram54288 | 0:dbad57390bd1 | 349 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 350 | TEST_ASSERT_EQUAL_HEX16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 351 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 352 | } |
ram54288 | 0:dbad57390bd1 | 353 | |
ram54288 | 0:dbad57390bd1 | 354 | void testNotEqualHex32s(void) |
ram54288 | 0:dbad57390bd1 | 355 | { |
ram54288 | 0:dbad57390bd1 | 356 | _UU32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 357 | |
ram54288 | 0:dbad57390bd1 | 358 | v0 = 900000; |
ram54288 | 0:dbad57390bd1 | 359 | v1 = 900001; |
ram54288 | 0:dbad57390bd1 | 360 | |
ram54288 | 0:dbad57390bd1 | 361 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 362 | TEST_ASSERT_EQUAL_HEX32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 363 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 364 | } |
ram54288 | 0:dbad57390bd1 | 365 | |
ram54288 | 0:dbad57390bd1 | 366 | void testNotEqualHex32sIfSigned(void) |
ram54288 | 0:dbad57390bd1 | 367 | { |
ram54288 | 0:dbad57390bd1 | 368 | _US32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 369 | |
ram54288 | 0:dbad57390bd1 | 370 | v0 = -900000; |
ram54288 | 0:dbad57390bd1 | 371 | v1 = 900001; |
ram54288 | 0:dbad57390bd1 | 372 | |
ram54288 | 0:dbad57390bd1 | 373 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 374 | TEST_ASSERT_EQUAL_HEX32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 375 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 376 | } |
ram54288 | 0:dbad57390bd1 | 377 | |
ram54288 | 0:dbad57390bd1 | 378 | void testEqualInts(void) |
ram54288 | 0:dbad57390bd1 | 379 | { |
ram54288 | 0:dbad57390bd1 | 380 | int v0, v1; |
ram54288 | 0:dbad57390bd1 | 381 | int *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 382 | |
ram54288 | 0:dbad57390bd1 | 383 | v0 = 19467; |
ram54288 | 0:dbad57390bd1 | 384 | v1 = 19467; |
ram54288 | 0:dbad57390bd1 | 385 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 386 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 387 | |
ram54288 | 0:dbad57390bd1 | 388 | TEST_ASSERT_EQUAL_INT(1837, 1837); |
ram54288 | 0:dbad57390bd1 | 389 | TEST_ASSERT_EQUAL_INT(-27365, -27365); |
ram54288 | 0:dbad57390bd1 | 390 | TEST_ASSERT_EQUAL_INT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 391 | TEST_ASSERT_EQUAL_INT(19467, v1); |
ram54288 | 0:dbad57390bd1 | 392 | TEST_ASSERT_EQUAL_INT(v0, 19467); |
ram54288 | 0:dbad57390bd1 | 393 | TEST_ASSERT_EQUAL_INT(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 394 | TEST_ASSERT_EQUAL_INT(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 395 | TEST_ASSERT_EQUAL_INT(*p0, 19467); |
ram54288 | 0:dbad57390bd1 | 396 | } |
ram54288 | 0:dbad57390bd1 | 397 | |
ram54288 | 0:dbad57390bd1 | 398 | void testEqualInt8s(void) |
ram54288 | 0:dbad57390bd1 | 399 | { |
ram54288 | 0:dbad57390bd1 | 400 | _US8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 401 | _US8 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 402 | |
ram54288 | 0:dbad57390bd1 | 403 | v0 = 0x22; |
ram54288 | 0:dbad57390bd1 | 404 | v1 = 0x22; |
ram54288 | 0:dbad57390bd1 | 405 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 406 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 407 | |
ram54288 | 0:dbad57390bd1 | 408 | TEST_ASSERT_EQUAL_INT8(0x22, 0x22); |
ram54288 | 0:dbad57390bd1 | 409 | TEST_ASSERT_EQUAL_INT8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 410 | TEST_ASSERT_EQUAL_INT8(0x22, v1); |
ram54288 | 0:dbad57390bd1 | 411 | TEST_ASSERT_EQUAL_INT8(v0, 0x22); |
ram54288 | 0:dbad57390bd1 | 412 | TEST_ASSERT_EQUAL_INT8(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 413 | TEST_ASSERT_EQUAL_INT8(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 414 | TEST_ASSERT_EQUAL_INT8(*p0, 0x22); |
ram54288 | 0:dbad57390bd1 | 415 | } |
ram54288 | 0:dbad57390bd1 | 416 | |
ram54288 | 0:dbad57390bd1 | 417 | void testEqualInt8sWhenThereAreDifferencesOutside8Bits(void) |
ram54288 | 0:dbad57390bd1 | 418 | { |
ram54288 | 0:dbad57390bd1 | 419 | TEST_ASSERT_EQUAL_INT8(0x321,0x421); |
ram54288 | 0:dbad57390bd1 | 420 | TEST_ASSERT_EQUAL_INT8(0xFF21,0x0021); |
ram54288 | 0:dbad57390bd1 | 421 | } |
ram54288 | 0:dbad57390bd1 | 422 | |
ram54288 | 0:dbad57390bd1 | 423 | void testEqualInt16s(void) |
ram54288 | 0:dbad57390bd1 | 424 | { |
ram54288 | 0:dbad57390bd1 | 425 | _US16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 426 | _US16 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 427 | |
ram54288 | 0:dbad57390bd1 | 428 | v0 = 0x7876; |
ram54288 | 0:dbad57390bd1 | 429 | v1 = 0x7876; |
ram54288 | 0:dbad57390bd1 | 430 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 431 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 432 | |
ram54288 | 0:dbad57390bd1 | 433 | TEST_ASSERT_EQUAL_INT16(0x7876, 0x7876); |
ram54288 | 0:dbad57390bd1 | 434 | TEST_ASSERT_EQUAL_INT16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 435 | TEST_ASSERT_EQUAL_INT16(0x7876, v1); |
ram54288 | 0:dbad57390bd1 | 436 | TEST_ASSERT_EQUAL_INT16(v0, 0x7876); |
ram54288 | 0:dbad57390bd1 | 437 | TEST_ASSERT_EQUAL_INT16(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 438 | TEST_ASSERT_EQUAL_INT16(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 439 | TEST_ASSERT_EQUAL_INT16(*p0, 0x7876); |
ram54288 | 0:dbad57390bd1 | 440 | } |
ram54288 | 0:dbad57390bd1 | 441 | |
ram54288 | 0:dbad57390bd1 | 442 | void testEqualInt16sNegatives(void) |
ram54288 | 0:dbad57390bd1 | 443 | { |
ram54288 | 0:dbad57390bd1 | 444 | _US16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 445 | _US16 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 446 | |
ram54288 | 0:dbad57390bd1 | 447 | v0 = -7876; |
ram54288 | 0:dbad57390bd1 | 448 | v1 = -7876; |
ram54288 | 0:dbad57390bd1 | 449 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 450 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 451 | |
ram54288 | 0:dbad57390bd1 | 452 | TEST_ASSERT_EQUAL_INT16(-7876, -7876); |
ram54288 | 0:dbad57390bd1 | 453 | TEST_ASSERT_EQUAL_INT16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 454 | TEST_ASSERT_EQUAL_INT16(-7876, v1); |
ram54288 | 0:dbad57390bd1 | 455 | TEST_ASSERT_EQUAL_INT16(v0, -7876); |
ram54288 | 0:dbad57390bd1 | 456 | TEST_ASSERT_EQUAL_INT16(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 457 | TEST_ASSERT_EQUAL_INT16(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 458 | TEST_ASSERT_EQUAL_INT16(*p0, -7876); |
ram54288 | 0:dbad57390bd1 | 459 | } |
ram54288 | 0:dbad57390bd1 | 460 | |
ram54288 | 0:dbad57390bd1 | 461 | void testEqualInt16sWhenThereAreDifferencesOutside16Bits(void) |
ram54288 | 0:dbad57390bd1 | 462 | { |
ram54288 | 0:dbad57390bd1 | 463 | TEST_ASSERT_EQUAL_INT16(0x54321,0x64321); |
ram54288 | 0:dbad57390bd1 | 464 | TEST_ASSERT_EQUAL_INT16(0xFFFF4321,0x00004321); |
ram54288 | 0:dbad57390bd1 | 465 | } |
ram54288 | 0:dbad57390bd1 | 466 | |
ram54288 | 0:dbad57390bd1 | 467 | void testEqualInt32s(void) |
ram54288 | 0:dbad57390bd1 | 468 | { |
ram54288 | 0:dbad57390bd1 | 469 | _US32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 470 | _US32 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 471 | |
ram54288 | 0:dbad57390bd1 | 472 | v0 = 0x78760000; |
ram54288 | 0:dbad57390bd1 | 473 | v1 = 0x78760000; |
ram54288 | 0:dbad57390bd1 | 474 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 475 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 476 | |
ram54288 | 0:dbad57390bd1 | 477 | TEST_ASSERT_EQUAL_INT32(0x78760000, 0x78760000); |
ram54288 | 0:dbad57390bd1 | 478 | TEST_ASSERT_EQUAL_INT32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 479 | TEST_ASSERT_EQUAL_INT32(0x78760000, v1); |
ram54288 | 0:dbad57390bd1 | 480 | TEST_ASSERT_EQUAL_INT32(v0, 0x78760000); |
ram54288 | 0:dbad57390bd1 | 481 | TEST_ASSERT_EQUAL_INT32(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 482 | TEST_ASSERT_EQUAL_INT32(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 483 | TEST_ASSERT_EQUAL_INT32(*p0, 0x78760000); |
ram54288 | 0:dbad57390bd1 | 484 | } |
ram54288 | 0:dbad57390bd1 | 485 | |
ram54288 | 0:dbad57390bd1 | 486 | void testEqualInt32sNegatives(void) |
ram54288 | 0:dbad57390bd1 | 487 | { |
ram54288 | 0:dbad57390bd1 | 488 | _US32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 489 | _US32 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 490 | |
ram54288 | 0:dbad57390bd1 | 491 | v0 = -123456789; |
ram54288 | 0:dbad57390bd1 | 492 | v1 = -123456789; |
ram54288 | 0:dbad57390bd1 | 493 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 494 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 495 | |
ram54288 | 0:dbad57390bd1 | 496 | TEST_ASSERT_EQUAL_INT32(-123456789, -123456789); |
ram54288 | 0:dbad57390bd1 | 497 | TEST_ASSERT_EQUAL_INT32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 498 | TEST_ASSERT_EQUAL_INT32(-123456789, v1); |
ram54288 | 0:dbad57390bd1 | 499 | TEST_ASSERT_EQUAL_INT32(v0, -123456789); |
ram54288 | 0:dbad57390bd1 | 500 | TEST_ASSERT_EQUAL_INT32(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 501 | TEST_ASSERT_EQUAL_INT32(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 502 | TEST_ASSERT_EQUAL_INT32(*p0, -123456789); |
ram54288 | 0:dbad57390bd1 | 503 | } |
ram54288 | 0:dbad57390bd1 | 504 | |
ram54288 | 0:dbad57390bd1 | 505 | |
ram54288 | 0:dbad57390bd1 | 506 | void testEqualUints(void) |
ram54288 | 0:dbad57390bd1 | 507 | { |
ram54288 | 0:dbad57390bd1 | 508 | unsigned int v0, v1; |
ram54288 | 0:dbad57390bd1 | 509 | unsigned int *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 510 | |
ram54288 | 0:dbad57390bd1 | 511 | v0 = 19467; |
ram54288 | 0:dbad57390bd1 | 512 | v1 = 19467; |
ram54288 | 0:dbad57390bd1 | 513 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 514 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 515 | |
ram54288 | 0:dbad57390bd1 | 516 | TEST_ASSERT_EQUAL_UINT(1837, 1837); |
ram54288 | 0:dbad57390bd1 | 517 | TEST_ASSERT_EQUAL_UINT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 518 | TEST_ASSERT_EQUAL_UINT(19467, v1); |
ram54288 | 0:dbad57390bd1 | 519 | TEST_ASSERT_EQUAL_UINT(v0, 19467); |
ram54288 | 0:dbad57390bd1 | 520 | TEST_ASSERT_EQUAL_UINT(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 521 | TEST_ASSERT_EQUAL_UINT(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 522 | TEST_ASSERT_EQUAL_UINT(*p0, 19467); |
ram54288 | 0:dbad57390bd1 | 523 | TEST_ASSERT_EQUAL_UINT(60872u, 60872u); |
ram54288 | 0:dbad57390bd1 | 524 | } |
ram54288 | 0:dbad57390bd1 | 525 | |
ram54288 | 0:dbad57390bd1 | 526 | |
ram54288 | 0:dbad57390bd1 | 527 | void testEqualUint8s(void) |
ram54288 | 0:dbad57390bd1 | 528 | { |
ram54288 | 0:dbad57390bd1 | 529 | _UU8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 530 | _UU8 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 531 | |
ram54288 | 0:dbad57390bd1 | 532 | v0 = 0x22; |
ram54288 | 0:dbad57390bd1 | 533 | v1 = 0x22; |
ram54288 | 0:dbad57390bd1 | 534 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 535 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 536 | |
ram54288 | 0:dbad57390bd1 | 537 | TEST_ASSERT_EQUAL_UINT8(0x22, 0x22); |
ram54288 | 0:dbad57390bd1 | 538 | TEST_ASSERT_EQUAL_UINT8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 539 | TEST_ASSERT_EQUAL_UINT8(0x22, v1); |
ram54288 | 0:dbad57390bd1 | 540 | TEST_ASSERT_EQUAL_UINT8(v0, 0x22); |
ram54288 | 0:dbad57390bd1 | 541 | TEST_ASSERT_EQUAL_UINT8(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 542 | TEST_ASSERT_EQUAL_UINT8(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 543 | TEST_ASSERT_EQUAL_UINT8(*p0, 0x22); |
ram54288 | 0:dbad57390bd1 | 544 | } |
ram54288 | 0:dbad57390bd1 | 545 | |
ram54288 | 0:dbad57390bd1 | 546 | void testEqualUint8sWhenThereAreDifferencesOutside8Bits(void) |
ram54288 | 0:dbad57390bd1 | 547 | { |
ram54288 | 0:dbad57390bd1 | 548 | TEST_ASSERT_EQUAL_UINT8(0x321,0x421); |
ram54288 | 0:dbad57390bd1 | 549 | TEST_ASSERT_EQUAL_UINT8(0xFF21,0x0021); |
ram54288 | 0:dbad57390bd1 | 550 | } |
ram54288 | 0:dbad57390bd1 | 551 | |
ram54288 | 0:dbad57390bd1 | 552 | void testEqualUint16s(void) |
ram54288 | 0:dbad57390bd1 | 553 | { |
ram54288 | 0:dbad57390bd1 | 554 | _UU16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 555 | _UU16 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 556 | |
ram54288 | 0:dbad57390bd1 | 557 | v0 = 0x9876; |
ram54288 | 0:dbad57390bd1 | 558 | v1 = 0x9876; |
ram54288 | 0:dbad57390bd1 | 559 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 560 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 561 | |
ram54288 | 0:dbad57390bd1 | 562 | TEST_ASSERT_EQUAL_UINT16(0x9876, 0x9876); |
ram54288 | 0:dbad57390bd1 | 563 | TEST_ASSERT_EQUAL_UINT16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 564 | TEST_ASSERT_EQUAL_UINT16(0x9876, v1); |
ram54288 | 0:dbad57390bd1 | 565 | TEST_ASSERT_EQUAL_UINT16(v0, 0x9876); |
ram54288 | 0:dbad57390bd1 | 566 | TEST_ASSERT_EQUAL_UINT16(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 567 | TEST_ASSERT_EQUAL_UINT16(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 568 | TEST_ASSERT_EQUAL_UINT16(*p0, 0x9876); |
ram54288 | 0:dbad57390bd1 | 569 | } |
ram54288 | 0:dbad57390bd1 | 570 | |
ram54288 | 0:dbad57390bd1 | 571 | void testEqualUint16sWhenThereAreDifferencesOutside16Bits(void) |
ram54288 | 0:dbad57390bd1 | 572 | { |
ram54288 | 0:dbad57390bd1 | 573 | TEST_ASSERT_EQUAL_UINT16(0x54321,0x64321); |
ram54288 | 0:dbad57390bd1 | 574 | TEST_ASSERT_EQUAL_UINT16(0xFFFF4321,0x00004321); |
ram54288 | 0:dbad57390bd1 | 575 | } |
ram54288 | 0:dbad57390bd1 | 576 | |
ram54288 | 0:dbad57390bd1 | 577 | void testEqualUint32s(void) |
ram54288 | 0:dbad57390bd1 | 578 | { |
ram54288 | 0:dbad57390bd1 | 579 | _UU32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 580 | _UU32 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 581 | |
ram54288 | 0:dbad57390bd1 | 582 | v0 = 0x98760000; |
ram54288 | 0:dbad57390bd1 | 583 | v1 = 0x98760000; |
ram54288 | 0:dbad57390bd1 | 584 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 585 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 586 | |
ram54288 | 0:dbad57390bd1 | 587 | TEST_ASSERT_EQUAL_UINT32(0x98760000, 0x98760000); |
ram54288 | 0:dbad57390bd1 | 588 | TEST_ASSERT_EQUAL_UINT32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 589 | TEST_ASSERT_EQUAL_UINT32(0x98760000, v1); |
ram54288 | 0:dbad57390bd1 | 590 | TEST_ASSERT_EQUAL_UINT32(v0, 0x98760000); |
ram54288 | 0:dbad57390bd1 | 591 | TEST_ASSERT_EQUAL_UINT32(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 592 | TEST_ASSERT_EQUAL_UINT32(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 593 | TEST_ASSERT_EQUAL_UINT32(*p0, 0x98760000); |
ram54288 | 0:dbad57390bd1 | 594 | } |
ram54288 | 0:dbad57390bd1 | 595 | |
ram54288 | 0:dbad57390bd1 | 596 | void testNotEqual(void) |
ram54288 | 0:dbad57390bd1 | 597 | { |
ram54288 | 0:dbad57390bd1 | 598 | TEST_ASSERT_NOT_EQUAL(0, 1); |
ram54288 | 0:dbad57390bd1 | 599 | TEST_ASSERT_NOT_EQUAL(1, 0); |
ram54288 | 0:dbad57390bd1 | 600 | TEST_ASSERT_NOT_EQUAL(100, 101); |
ram54288 | 0:dbad57390bd1 | 601 | TEST_ASSERT_NOT_EQUAL(0, -1); |
ram54288 | 0:dbad57390bd1 | 602 | TEST_ASSERT_NOT_EQUAL(65535, -65535); |
ram54288 | 0:dbad57390bd1 | 603 | TEST_ASSERT_NOT_EQUAL(75, 900); |
ram54288 | 0:dbad57390bd1 | 604 | TEST_ASSERT_NOT_EQUAL(-100, -101); |
ram54288 | 0:dbad57390bd1 | 605 | } |
ram54288 | 0:dbad57390bd1 | 606 | |
ram54288 | 0:dbad57390bd1 | 607 | void testEqualHex8s(void) |
ram54288 | 0:dbad57390bd1 | 608 | { |
ram54288 | 0:dbad57390bd1 | 609 | _UU8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 610 | _UU8 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 611 | |
ram54288 | 0:dbad57390bd1 | 612 | v0 = 0x22; |
ram54288 | 0:dbad57390bd1 | 613 | v1 = 0x22; |
ram54288 | 0:dbad57390bd1 | 614 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 615 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 616 | |
ram54288 | 0:dbad57390bd1 | 617 | TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); |
ram54288 | 0:dbad57390bd1 | 618 | TEST_ASSERT_EQUAL_HEX8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 619 | TEST_ASSERT_EQUAL_HEX8(0x22, v1); |
ram54288 | 0:dbad57390bd1 | 620 | TEST_ASSERT_EQUAL_HEX8(v0, 0x22); |
ram54288 | 0:dbad57390bd1 | 621 | TEST_ASSERT_EQUAL_HEX8(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 622 | TEST_ASSERT_EQUAL_HEX8(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 623 | TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); |
ram54288 | 0:dbad57390bd1 | 624 | } |
ram54288 | 0:dbad57390bd1 | 625 | |
ram54288 | 0:dbad57390bd1 | 626 | void testEqualHex8sWhenThereAreDifferencesOutside8Bits(void) |
ram54288 | 0:dbad57390bd1 | 627 | { |
ram54288 | 0:dbad57390bd1 | 628 | TEST_ASSERT_EQUAL_HEX8(0x321,0x421); |
ram54288 | 0:dbad57390bd1 | 629 | TEST_ASSERT_EQUAL_HEX8(0xFF21,0x0021); |
ram54288 | 0:dbad57390bd1 | 630 | } |
ram54288 | 0:dbad57390bd1 | 631 | |
ram54288 | 0:dbad57390bd1 | 632 | void testEqualHex8sNegatives(void) |
ram54288 | 0:dbad57390bd1 | 633 | { |
ram54288 | 0:dbad57390bd1 | 634 | _UU8 v0, v1; |
ram54288 | 0:dbad57390bd1 | 635 | _UU8 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 636 | |
ram54288 | 0:dbad57390bd1 | 637 | v0 = 0xDD; |
ram54288 | 0:dbad57390bd1 | 638 | v1 = 0xDD; |
ram54288 | 0:dbad57390bd1 | 639 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 640 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 641 | |
ram54288 | 0:dbad57390bd1 | 642 | TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); |
ram54288 | 0:dbad57390bd1 | 643 | TEST_ASSERT_EQUAL_HEX8(v0, v1); |
ram54288 | 0:dbad57390bd1 | 644 | TEST_ASSERT_EQUAL_HEX8(0xDD, v1); |
ram54288 | 0:dbad57390bd1 | 645 | TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); |
ram54288 | 0:dbad57390bd1 | 646 | TEST_ASSERT_EQUAL_HEX8(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 647 | TEST_ASSERT_EQUAL_HEX8(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 648 | TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); |
ram54288 | 0:dbad57390bd1 | 649 | } |
ram54288 | 0:dbad57390bd1 | 650 | |
ram54288 | 0:dbad57390bd1 | 651 | void testEqualHex16s(void) |
ram54288 | 0:dbad57390bd1 | 652 | { |
ram54288 | 0:dbad57390bd1 | 653 | _UU16 v0, v1; |
ram54288 | 0:dbad57390bd1 | 654 | _UU16 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 655 | |
ram54288 | 0:dbad57390bd1 | 656 | v0 = 0x9876; |
ram54288 | 0:dbad57390bd1 | 657 | v1 = 0x9876; |
ram54288 | 0:dbad57390bd1 | 658 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 659 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 660 | |
ram54288 | 0:dbad57390bd1 | 661 | TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); |
ram54288 | 0:dbad57390bd1 | 662 | TEST_ASSERT_EQUAL_HEX16(v0, v1); |
ram54288 | 0:dbad57390bd1 | 663 | TEST_ASSERT_EQUAL_HEX16(0x9876, v1); |
ram54288 | 0:dbad57390bd1 | 664 | TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); |
ram54288 | 0:dbad57390bd1 | 665 | TEST_ASSERT_EQUAL_HEX16(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 666 | TEST_ASSERT_EQUAL_HEX16(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 667 | TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); |
ram54288 | 0:dbad57390bd1 | 668 | } |
ram54288 | 0:dbad57390bd1 | 669 | |
ram54288 | 0:dbad57390bd1 | 670 | void testEqualHex16sWhenThereAreDifferencesOutside16Bits(void) |
ram54288 | 0:dbad57390bd1 | 671 | { |
ram54288 | 0:dbad57390bd1 | 672 | TEST_ASSERT_EQUAL_HEX16(0x54321,0x64321); |
ram54288 | 0:dbad57390bd1 | 673 | TEST_ASSERT_EQUAL_HEX16(0xFFFF4321,0x00004321); |
ram54288 | 0:dbad57390bd1 | 674 | } |
ram54288 | 0:dbad57390bd1 | 675 | |
ram54288 | 0:dbad57390bd1 | 676 | void testEqualHex32s(void) |
ram54288 | 0:dbad57390bd1 | 677 | { |
ram54288 | 0:dbad57390bd1 | 678 | _UU32 v0, v1; |
ram54288 | 0:dbad57390bd1 | 679 | _UU32 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 680 | |
ram54288 | 0:dbad57390bd1 | 681 | v0 = 0x98765432ul; |
ram54288 | 0:dbad57390bd1 | 682 | v1 = 0x98765432ul; |
ram54288 | 0:dbad57390bd1 | 683 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 684 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 685 | |
ram54288 | 0:dbad57390bd1 | 686 | TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); |
ram54288 | 0:dbad57390bd1 | 687 | TEST_ASSERT_EQUAL_HEX32(v0, v1); |
ram54288 | 0:dbad57390bd1 | 688 | TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); |
ram54288 | 0:dbad57390bd1 | 689 | TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); |
ram54288 | 0:dbad57390bd1 | 690 | TEST_ASSERT_EQUAL_HEX32(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 691 | TEST_ASSERT_EQUAL_HEX32(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 692 | TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); |
ram54288 | 0:dbad57390bd1 | 693 | } |
ram54288 | 0:dbad57390bd1 | 694 | |
ram54288 | 0:dbad57390bd1 | 695 | void testEqualBits(void) |
ram54288 | 0:dbad57390bd1 | 696 | { |
ram54288 | 0:dbad57390bd1 | 697 | _UU32 v0 = 0xFF55AA00; |
ram54288 | 0:dbad57390bd1 | 698 | _UU32 v1 = 0x55550000; |
ram54288 | 0:dbad57390bd1 | 699 | |
ram54288 | 0:dbad57390bd1 | 700 | TEST_ASSERT_BITS(v1, v0, 0x55550000); |
ram54288 | 0:dbad57390bd1 | 701 | TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); |
ram54288 | 0:dbad57390bd1 | 702 | TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); |
ram54288 | 0:dbad57390bd1 | 703 | TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); |
ram54288 | 0:dbad57390bd1 | 704 | TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); |
ram54288 | 0:dbad57390bd1 | 705 | TEST_ASSERT_BITS_HIGH(v1, v0); |
ram54288 | 0:dbad57390bd1 | 706 | TEST_ASSERT_BITS_LOW(0x000055FF, v0); |
ram54288 | 0:dbad57390bd1 | 707 | TEST_ASSERT_BIT_HIGH(30, v0); |
ram54288 | 0:dbad57390bd1 | 708 | TEST_ASSERT_BIT_LOW(5, v0); |
ram54288 | 0:dbad57390bd1 | 709 | } |
ram54288 | 0:dbad57390bd1 | 710 | |
ram54288 | 0:dbad57390bd1 | 711 | void testNotEqualBitHigh(void) |
ram54288 | 0:dbad57390bd1 | 712 | { |
ram54288 | 0:dbad57390bd1 | 713 | _UU32 v0 = 0x7F55AA00; |
ram54288 | 0:dbad57390bd1 | 714 | |
ram54288 | 0:dbad57390bd1 | 715 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 716 | TEST_ASSERT_BIT_HIGH(31, v0); |
ram54288 | 0:dbad57390bd1 | 717 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 718 | } |
ram54288 | 0:dbad57390bd1 | 719 | |
ram54288 | 0:dbad57390bd1 | 720 | void testNotEqualBitLow(void) |
ram54288 | 0:dbad57390bd1 | 721 | { |
ram54288 | 0:dbad57390bd1 | 722 | _UU32 v0 = 0xFF55AA00; |
ram54288 | 0:dbad57390bd1 | 723 | |
ram54288 | 0:dbad57390bd1 | 724 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 725 | TEST_ASSERT_BIT_LOW(30, v0); |
ram54288 | 0:dbad57390bd1 | 726 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 727 | } |
ram54288 | 0:dbad57390bd1 | 728 | |
ram54288 | 0:dbad57390bd1 | 729 | void testNotEqualBitsHigh(void) |
ram54288 | 0:dbad57390bd1 | 730 | { |
ram54288 | 0:dbad57390bd1 | 731 | _UU32 v0 = 0xFF55AA00; |
ram54288 | 0:dbad57390bd1 | 732 | _UU32 v1 = 0x55550000; |
ram54288 | 0:dbad57390bd1 | 733 | |
ram54288 | 0:dbad57390bd1 | 734 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 735 | TEST_ASSERT_BITS_HIGH(v0, v1); |
ram54288 | 0:dbad57390bd1 | 736 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 737 | |
ram54288 | 0:dbad57390bd1 | 738 | } |
ram54288 | 0:dbad57390bd1 | 739 | |
ram54288 | 0:dbad57390bd1 | 740 | void testNotEqualBitsLow(void) |
ram54288 | 0:dbad57390bd1 | 741 | { |
ram54288 | 0:dbad57390bd1 | 742 | _UU32 v0 = 0xFF55AA00; |
ram54288 | 0:dbad57390bd1 | 743 | _UU32 v1 = 0x55550000; |
ram54288 | 0:dbad57390bd1 | 744 | |
ram54288 | 0:dbad57390bd1 | 745 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 746 | TEST_ASSERT_BITS_LOW(v0, v1); |
ram54288 | 0:dbad57390bd1 | 747 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 748 | |
ram54288 | 0:dbad57390bd1 | 749 | } |
ram54288 | 0:dbad57390bd1 | 750 | void testEqualShorts(void) |
ram54288 | 0:dbad57390bd1 | 751 | { |
ram54288 | 0:dbad57390bd1 | 752 | short v0, v1; |
ram54288 | 0:dbad57390bd1 | 753 | short *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 754 | |
ram54288 | 0:dbad57390bd1 | 755 | v0 = 19467; |
ram54288 | 0:dbad57390bd1 | 756 | v1 = 19467; |
ram54288 | 0:dbad57390bd1 | 757 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 758 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 759 | |
ram54288 | 0:dbad57390bd1 | 760 | TEST_ASSERT_EQUAL_INT(1837, 1837); |
ram54288 | 0:dbad57390bd1 | 761 | TEST_ASSERT_EQUAL_INT(-2987, -2987); |
ram54288 | 0:dbad57390bd1 | 762 | TEST_ASSERT_EQUAL_INT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 763 | TEST_ASSERT_EQUAL_INT(19467, v1); |
ram54288 | 0:dbad57390bd1 | 764 | TEST_ASSERT_EQUAL_INT(v0, 19467); |
ram54288 | 0:dbad57390bd1 | 765 | TEST_ASSERT_EQUAL_INT(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 766 | TEST_ASSERT_EQUAL_INT(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 767 | TEST_ASSERT_EQUAL_INT(*p0, 19467); |
ram54288 | 0:dbad57390bd1 | 768 | } |
ram54288 | 0:dbad57390bd1 | 769 | |
ram54288 | 0:dbad57390bd1 | 770 | void testEqualUShorts(void) |
ram54288 | 0:dbad57390bd1 | 771 | { |
ram54288 | 0:dbad57390bd1 | 772 | unsigned short v0, v1; |
ram54288 | 0:dbad57390bd1 | 773 | unsigned short *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 774 | |
ram54288 | 0:dbad57390bd1 | 775 | v0 = 19467; |
ram54288 | 0:dbad57390bd1 | 776 | v1 = 19467; |
ram54288 | 0:dbad57390bd1 | 777 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 778 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 779 | |
ram54288 | 0:dbad57390bd1 | 780 | TEST_ASSERT_EQUAL_UINT(1837, 1837); |
ram54288 | 0:dbad57390bd1 | 781 | TEST_ASSERT_EQUAL_UINT(2987, 2987); |
ram54288 | 0:dbad57390bd1 | 782 | TEST_ASSERT_EQUAL_UINT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 783 | TEST_ASSERT_EQUAL_UINT(19467, v1); |
ram54288 | 0:dbad57390bd1 | 784 | TEST_ASSERT_EQUAL_UINT(v0, 19467); |
ram54288 | 0:dbad57390bd1 | 785 | TEST_ASSERT_EQUAL_UINT(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 786 | TEST_ASSERT_EQUAL_UINT(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 787 | TEST_ASSERT_EQUAL_UINT(*p0, 19467); |
ram54288 | 0:dbad57390bd1 | 788 | } |
ram54288 | 0:dbad57390bd1 | 789 | |
ram54288 | 0:dbad57390bd1 | 790 | void testEqualChars(void) |
ram54288 | 0:dbad57390bd1 | 791 | { |
ram54288 | 0:dbad57390bd1 | 792 | signed char v0, v1; |
ram54288 | 0:dbad57390bd1 | 793 | signed char *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 794 | |
ram54288 | 0:dbad57390bd1 | 795 | v0 = 109; |
ram54288 | 0:dbad57390bd1 | 796 | v1 = 109; |
ram54288 | 0:dbad57390bd1 | 797 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 798 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 799 | |
ram54288 | 0:dbad57390bd1 | 800 | TEST_ASSERT_EQUAL_INT(42, 42); |
ram54288 | 0:dbad57390bd1 | 801 | TEST_ASSERT_EQUAL_INT(-116, -116); |
ram54288 | 0:dbad57390bd1 | 802 | TEST_ASSERT_EQUAL_INT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 803 | TEST_ASSERT_EQUAL_INT(109, v1); |
ram54288 | 0:dbad57390bd1 | 804 | TEST_ASSERT_EQUAL_INT(v0, 109); |
ram54288 | 0:dbad57390bd1 | 805 | TEST_ASSERT_EQUAL_INT(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 806 | TEST_ASSERT_EQUAL_INT(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 807 | TEST_ASSERT_EQUAL_INT(*p0, 109); |
ram54288 | 0:dbad57390bd1 | 808 | } |
ram54288 | 0:dbad57390bd1 | 809 | |
ram54288 | 0:dbad57390bd1 | 810 | void testEqualUChars(void) |
ram54288 | 0:dbad57390bd1 | 811 | { |
ram54288 | 0:dbad57390bd1 | 812 | unsigned char v0, v1; |
ram54288 | 0:dbad57390bd1 | 813 | unsigned char *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 814 | |
ram54288 | 0:dbad57390bd1 | 815 | v0 = 251; |
ram54288 | 0:dbad57390bd1 | 816 | v1 = 251; |
ram54288 | 0:dbad57390bd1 | 817 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 818 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 819 | |
ram54288 | 0:dbad57390bd1 | 820 | TEST_ASSERT_EQUAL_INT(42, 42); |
ram54288 | 0:dbad57390bd1 | 821 | TEST_ASSERT_EQUAL_INT(v0, v1); |
ram54288 | 0:dbad57390bd1 | 822 | TEST_ASSERT_EQUAL_INT(251, v1); |
ram54288 | 0:dbad57390bd1 | 823 | TEST_ASSERT_EQUAL_INT(v0, 251); |
ram54288 | 0:dbad57390bd1 | 824 | TEST_ASSERT_EQUAL_INT(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 825 | TEST_ASSERT_EQUAL_INT(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 826 | TEST_ASSERT_EQUAL_INT(*p0, 251); |
ram54288 | 0:dbad57390bd1 | 827 | } |
ram54288 | 0:dbad57390bd1 | 828 | |
ram54288 | 0:dbad57390bd1 | 829 | void testEqualPointers(void) |
ram54288 | 0:dbad57390bd1 | 830 | { |
ram54288 | 0:dbad57390bd1 | 831 | int v0, v1; |
ram54288 | 0:dbad57390bd1 | 832 | int *p0, *p1, *p2; |
ram54288 | 0:dbad57390bd1 | 833 | |
ram54288 | 0:dbad57390bd1 | 834 | v0 = 19467; |
ram54288 | 0:dbad57390bd1 | 835 | v1 = 18271; |
ram54288 | 0:dbad57390bd1 | 836 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 837 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 838 | p2 = &v1; |
ram54288 | 0:dbad57390bd1 | 839 | |
ram54288 | 0:dbad57390bd1 | 840 | TEST_ASSERT_EQUAL_PTR(p0, &v0); |
ram54288 | 0:dbad57390bd1 | 841 | TEST_ASSERT_EQUAL_PTR(&v1, p1); |
ram54288 | 0:dbad57390bd1 | 842 | TEST_ASSERT_EQUAL_PTR(p2, p1); |
ram54288 | 0:dbad57390bd1 | 843 | TEST_ASSERT_EQUAL_PTR(&v0, &v0); |
ram54288 | 0:dbad57390bd1 | 844 | } |
ram54288 | 0:dbad57390bd1 | 845 | |
ram54288 | 0:dbad57390bd1 | 846 | void testNotEqualPointers(void) |
ram54288 | 0:dbad57390bd1 | 847 | { |
ram54288 | 0:dbad57390bd1 | 848 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 849 | TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); |
ram54288 | 0:dbad57390bd1 | 850 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 851 | } |
ram54288 | 0:dbad57390bd1 | 852 | |
ram54288 | 0:dbad57390bd1 | 853 | void testIntsWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 854 | { |
ram54288 | 0:dbad57390bd1 | 855 | TEST_ASSERT_INT_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 856 | TEST_ASSERT_INT_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 857 | TEST_ASSERT_INT_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 858 | TEST_ASSERT_INT_WITHIN(500, 50, -440); |
ram54288 | 0:dbad57390bd1 | 859 | |
ram54288 | 0:dbad57390bd1 | 860 | TEST_ASSERT_INT_WITHIN(2, -1, -1); |
ram54288 | 0:dbad57390bd1 | 861 | TEST_ASSERT_INT_WITHIN(5, 1, -1); |
ram54288 | 0:dbad57390bd1 | 862 | TEST_ASSERT_INT_WITHIN(5, -1, 1); |
ram54288 | 0:dbad57390bd1 | 863 | } |
ram54288 | 0:dbad57390bd1 | 864 | |
ram54288 | 0:dbad57390bd1 | 865 | void testIntsWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 866 | { |
ram54288 | 0:dbad57390bd1 | 867 | TEST_ASSERT_INT_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 868 | TEST_ASSERT_INT_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 869 | TEST_ASSERT_INT_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 870 | TEST_ASSERT_INT_WITHIN_MESSAGE(500, 50, -440, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 871 | |
ram54288 | 0:dbad57390bd1 | 872 | TEST_ASSERT_INT_WITHIN_MESSAGE(2, -1, -1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 873 | TEST_ASSERT_INT_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 874 | TEST_ASSERT_INT_WITHIN_MESSAGE(5, -1, 1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 875 | } |
ram54288 | 0:dbad57390bd1 | 876 | |
ram54288 | 0:dbad57390bd1 | 877 | void testIntsNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 878 | { |
ram54288 | 0:dbad57390bd1 | 879 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 880 | TEST_ASSERT_INT_WITHIN(5, 5000, 5006); |
ram54288 | 0:dbad57390bd1 | 881 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 882 | } |
ram54288 | 0:dbad57390bd1 | 883 | |
ram54288 | 0:dbad57390bd1 | 884 | void testIntsNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 885 | { |
ram54288 | 0:dbad57390bd1 | 886 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 887 | TEST_ASSERT_INT_WITHIN_MESSAGE(5, 5000, 5006, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 888 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 889 | } |
ram54288 | 0:dbad57390bd1 | 890 | |
ram54288 | 0:dbad57390bd1 | 891 | void testUIntsWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 892 | { |
ram54288 | 0:dbad57390bd1 | 893 | TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 894 | TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 895 | TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 896 | } |
ram54288 | 0:dbad57390bd1 | 897 | |
ram54288 | 0:dbad57390bd1 | 898 | void testUIntsWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 899 | { |
ram54288 | 0:dbad57390bd1 | 900 | TEST_ASSERT_UINT_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 901 | TEST_ASSERT_UINT_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 902 | TEST_ASSERT_UINT_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 903 | } |
ram54288 | 0:dbad57390bd1 | 904 | |
ram54288 | 0:dbad57390bd1 | 905 | void testUIntsNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 906 | { |
ram54288 | 0:dbad57390bd1 | 907 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 908 | TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); |
ram54288 | 0:dbad57390bd1 | 909 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 910 | } |
ram54288 | 0:dbad57390bd1 | 911 | |
ram54288 | 0:dbad57390bd1 | 912 | void testUIntsNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 913 | { |
ram54288 | 0:dbad57390bd1 | 914 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 915 | TEST_ASSERT_UINT_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 916 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 917 | } |
ram54288 | 0:dbad57390bd1 | 918 | |
ram54288 | 0:dbad57390bd1 | 919 | void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) |
ram54288 | 0:dbad57390bd1 | 920 | { |
ram54288 | 0:dbad57390bd1 | 921 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 922 | TEST_ASSERT_UINT_WITHIN(5, 1, -1); |
ram54288 | 0:dbad57390bd1 | 923 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 924 | } |
ram54288 | 0:dbad57390bd1 | 925 | |
ram54288 | 0:dbad57390bd1 | 926 | void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirstAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 927 | { |
ram54288 | 0:dbad57390bd1 | 928 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 929 | TEST_ASSERT_UINT_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 930 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 931 | } |
ram54288 | 0:dbad57390bd1 | 932 | |
ram54288 | 0:dbad57390bd1 | 933 | void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) |
ram54288 | 0:dbad57390bd1 | 934 | { |
ram54288 | 0:dbad57390bd1 | 935 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 936 | TEST_ASSERT_UINT_WITHIN(5, -1, 1); |
ram54288 | 0:dbad57390bd1 | 937 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 938 | } |
ram54288 | 0:dbad57390bd1 | 939 | |
ram54288 | 0:dbad57390bd1 | 940 | void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirstAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 941 | { |
ram54288 | 0:dbad57390bd1 | 942 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 943 | TEST_ASSERT_UINT_WITHIN_MESSAGE(5, -1, 1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 944 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 945 | } |
ram54288 | 0:dbad57390bd1 | 946 | |
ram54288 | 0:dbad57390bd1 | 947 | void testHEX32sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 948 | { |
ram54288 | 0:dbad57390bd1 | 949 | TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 950 | TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 951 | TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 952 | } |
ram54288 | 0:dbad57390bd1 | 953 | |
ram54288 | 0:dbad57390bd1 | 954 | void testHEX32sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 955 | { |
ram54288 | 0:dbad57390bd1 | 956 | TEST_ASSERT_HEX32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 957 | TEST_ASSERT_HEX32_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 958 | TEST_ASSERT_HEX32_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 959 | } |
ram54288 | 0:dbad57390bd1 | 960 | |
ram54288 | 0:dbad57390bd1 | 961 | void testHEX32sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 962 | { |
ram54288 | 0:dbad57390bd1 | 963 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 964 | TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); |
ram54288 | 0:dbad57390bd1 | 965 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 966 | } |
ram54288 | 0:dbad57390bd1 | 967 | |
ram54288 | 0:dbad57390bd1 | 968 | void testHEX32sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 969 | { |
ram54288 | 0:dbad57390bd1 | 970 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 971 | TEST_ASSERT_HEX32_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 972 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 973 | } |
ram54288 | 0:dbad57390bd1 | 974 | |
ram54288 | 0:dbad57390bd1 | 975 | void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) |
ram54288 | 0:dbad57390bd1 | 976 | { |
ram54288 | 0:dbad57390bd1 | 977 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 978 | TEST_ASSERT_HEX32_WITHIN(5, 1, -1); |
ram54288 | 0:dbad57390bd1 | 979 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 980 | } |
ram54288 | 0:dbad57390bd1 | 981 | |
ram54288 | 0:dbad57390bd1 | 982 | void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPassAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 983 | { |
ram54288 | 0:dbad57390bd1 | 984 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 985 | TEST_ASSERT_HEX32_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 986 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 987 | } |
ram54288 | 0:dbad57390bd1 | 988 | |
ram54288 | 0:dbad57390bd1 | 989 | void testHEX16sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 990 | { |
ram54288 | 0:dbad57390bd1 | 991 | TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 992 | TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 993 | TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 994 | } |
ram54288 | 0:dbad57390bd1 | 995 | |
ram54288 | 0:dbad57390bd1 | 996 | void testHEX16sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 997 | { |
ram54288 | 0:dbad57390bd1 | 998 | TEST_ASSERT_HEX16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 999 | TEST_ASSERT_HEX16_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1000 | TEST_ASSERT_HEX16_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1001 | } |
ram54288 | 0:dbad57390bd1 | 1002 | |
ram54288 | 0:dbad57390bd1 | 1003 | void testHEX16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void) |
ram54288 | 0:dbad57390bd1 | 1004 | { |
ram54288 | 0:dbad57390bd1 | 1005 | TEST_ASSERT_HEX16_WITHIN(5, 0x54321, 0x44321); |
ram54288 | 0:dbad57390bd1 | 1006 | } |
ram54288 | 0:dbad57390bd1 | 1007 | |
ram54288 | 0:dbad57390bd1 | 1008 | void testHEX16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1009 | { |
ram54288 | 0:dbad57390bd1 | 1010 | TEST_ASSERT_HEX16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1011 | } |
ram54288 | 0:dbad57390bd1 | 1012 | |
ram54288 | 0:dbad57390bd1 | 1013 | void testHEX16sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1014 | { |
ram54288 | 0:dbad57390bd1 | 1015 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1016 | TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); |
ram54288 | 0:dbad57390bd1 | 1017 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1018 | } |
ram54288 | 0:dbad57390bd1 | 1019 | |
ram54288 | 0:dbad57390bd1 | 1020 | void testHEX16sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1021 | { |
ram54288 | 0:dbad57390bd1 | 1022 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1023 | TEST_ASSERT_HEX16_WITHIN_MESSAGE(2, 65535, 0, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1024 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1025 | } |
ram54288 | 0:dbad57390bd1 | 1026 | |
ram54288 | 0:dbad57390bd1 | 1027 | void testHEX8sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1028 | { |
ram54288 | 0:dbad57390bd1 | 1029 | TEST_ASSERT_HEX8_WITHIN(1, 254, 255); |
ram54288 | 0:dbad57390bd1 | 1030 | TEST_ASSERT_HEX8_WITHIN(5, 251, 255); |
ram54288 | 0:dbad57390bd1 | 1031 | TEST_ASSERT_HEX8_WITHIN(5, 1, 4); |
ram54288 | 0:dbad57390bd1 | 1032 | } |
ram54288 | 0:dbad57390bd1 | 1033 | |
ram54288 | 0:dbad57390bd1 | 1034 | void testHEX8sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1035 | { |
ram54288 | 0:dbad57390bd1 | 1036 | TEST_ASSERT_HEX8_WITHIN_MESSAGE(1, 254, 255, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1037 | TEST_ASSERT_HEX8_WITHIN_MESSAGE(5, 251, 255, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1038 | TEST_ASSERT_HEX8_WITHIN_MESSAGE(5, 1, 4, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1039 | } |
ram54288 | 0:dbad57390bd1 | 1040 | |
ram54288 | 0:dbad57390bd1 | 1041 | void testHEX8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void) |
ram54288 | 0:dbad57390bd1 | 1042 | { |
ram54288 | 0:dbad57390bd1 | 1043 | TEST_ASSERT_HEX8_WITHIN(5, 0x123, 0xF23); |
ram54288 | 0:dbad57390bd1 | 1044 | } |
ram54288 | 0:dbad57390bd1 | 1045 | |
ram54288 | 0:dbad57390bd1 | 1046 | void testHEX8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1047 | { |
ram54288 | 0:dbad57390bd1 | 1048 | TEST_ASSERT_HEX8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1049 | } |
ram54288 | 0:dbad57390bd1 | 1050 | |
ram54288 | 0:dbad57390bd1 | 1051 | void testHEX8sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1052 | { |
ram54288 | 0:dbad57390bd1 | 1053 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1054 | TEST_ASSERT_HEX8_WITHIN(2, 255, 0); |
ram54288 | 0:dbad57390bd1 | 1055 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1056 | } |
ram54288 | 0:dbad57390bd1 | 1057 | |
ram54288 | 0:dbad57390bd1 | 1058 | void testHEX8sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1059 | { |
ram54288 | 0:dbad57390bd1 | 1060 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1061 | TEST_ASSERT_HEX8_WITHIN_MESSAGE(2, 255, 0, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1062 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1063 | } |
ram54288 | 0:dbad57390bd1 | 1064 | |
ram54288 | 0:dbad57390bd1 | 1065 | //----------------- |
ram54288 | 0:dbad57390bd1 | 1066 | |
ram54288 | 0:dbad57390bd1 | 1067 | void testUINT32sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1068 | { |
ram54288 | 0:dbad57390bd1 | 1069 | TEST_ASSERT_UINT32_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 1070 | TEST_ASSERT_UINT32_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 1071 | TEST_ASSERT_UINT32_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 1072 | } |
ram54288 | 0:dbad57390bd1 | 1073 | |
ram54288 | 0:dbad57390bd1 | 1074 | void testUINT32sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1075 | { |
ram54288 | 0:dbad57390bd1 | 1076 | TEST_ASSERT_UINT32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1077 | TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1078 | TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1079 | } |
ram54288 | 0:dbad57390bd1 | 1080 | |
ram54288 | 0:dbad57390bd1 | 1081 | void testUINT32sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1082 | { |
ram54288 | 0:dbad57390bd1 | 1083 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1084 | TEST_ASSERT_UINT32_WITHIN(1, 2147483647u, 2147483649u); |
ram54288 | 0:dbad57390bd1 | 1085 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1086 | } |
ram54288 | 0:dbad57390bd1 | 1087 | |
ram54288 | 0:dbad57390bd1 | 1088 | void testUINT32sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1089 | { |
ram54288 | 0:dbad57390bd1 | 1090 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1091 | TEST_ASSERT_UINT32_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1092 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1093 | } |
ram54288 | 0:dbad57390bd1 | 1094 | |
ram54288 | 0:dbad57390bd1 | 1095 | void testUINT32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) |
ram54288 | 0:dbad57390bd1 | 1096 | { |
ram54288 | 0:dbad57390bd1 | 1097 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1098 | TEST_ASSERT_UINT32_WITHIN(5, 1, -1); |
ram54288 | 0:dbad57390bd1 | 1099 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1100 | } |
ram54288 | 0:dbad57390bd1 | 1101 | |
ram54288 | 0:dbad57390bd1 | 1102 | void testUINT32sNotWithinDeltaEvenThoughASignedIntWouldPassAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1103 | { |
ram54288 | 0:dbad57390bd1 | 1104 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1105 | TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1106 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1107 | } |
ram54288 | 0:dbad57390bd1 | 1108 | |
ram54288 | 0:dbad57390bd1 | 1109 | void testUINT16sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1110 | { |
ram54288 | 0:dbad57390bd1 | 1111 | TEST_ASSERT_UINT16_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 1112 | TEST_ASSERT_UINT16_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 1113 | TEST_ASSERT_UINT16_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 1114 | } |
ram54288 | 0:dbad57390bd1 | 1115 | |
ram54288 | 0:dbad57390bd1 | 1116 | void testUINT16sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1117 | { |
ram54288 | 0:dbad57390bd1 | 1118 | TEST_ASSERT_UINT16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1119 | TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1120 | TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1121 | } |
ram54288 | 0:dbad57390bd1 | 1122 | |
ram54288 | 0:dbad57390bd1 | 1123 | void testUINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void) |
ram54288 | 0:dbad57390bd1 | 1124 | { |
ram54288 | 0:dbad57390bd1 | 1125 | TEST_ASSERT_UINT16_WITHIN(5, 0x54321, 0x44321); |
ram54288 | 0:dbad57390bd1 | 1126 | } |
ram54288 | 0:dbad57390bd1 | 1127 | |
ram54288 | 0:dbad57390bd1 | 1128 | void testUINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1129 | { |
ram54288 | 0:dbad57390bd1 | 1130 | TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1131 | } |
ram54288 | 0:dbad57390bd1 | 1132 | |
ram54288 | 0:dbad57390bd1 | 1133 | void testUINT16sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1134 | { |
ram54288 | 0:dbad57390bd1 | 1135 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1136 | TEST_ASSERT_UINT16_WITHIN(2, 65535, 0); |
ram54288 | 0:dbad57390bd1 | 1137 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1138 | } |
ram54288 | 0:dbad57390bd1 | 1139 | |
ram54288 | 0:dbad57390bd1 | 1140 | void testUINT16sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1141 | { |
ram54288 | 0:dbad57390bd1 | 1142 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1143 | TEST_ASSERT_UINT16_WITHIN_MESSAGE(2, 65535, 0, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1144 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1145 | } |
ram54288 | 0:dbad57390bd1 | 1146 | |
ram54288 | 0:dbad57390bd1 | 1147 | void testUINT8sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1148 | { |
ram54288 | 0:dbad57390bd1 | 1149 | TEST_ASSERT_UINT8_WITHIN(1, 254, 255); |
ram54288 | 0:dbad57390bd1 | 1150 | TEST_ASSERT_UINT8_WITHIN(5, 251, 255); |
ram54288 | 0:dbad57390bd1 | 1151 | TEST_ASSERT_UINT8_WITHIN(5, 1, 4); |
ram54288 | 0:dbad57390bd1 | 1152 | } |
ram54288 | 0:dbad57390bd1 | 1153 | |
ram54288 | 0:dbad57390bd1 | 1154 | void testUINT8sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1155 | { |
ram54288 | 0:dbad57390bd1 | 1156 | TEST_ASSERT_UINT8_WITHIN_MESSAGE(1, 254, 255, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1157 | TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 251, 255, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1158 | TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 1, 4, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1159 | } |
ram54288 | 0:dbad57390bd1 | 1160 | |
ram54288 | 0:dbad57390bd1 | 1161 | void testUINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void) |
ram54288 | 0:dbad57390bd1 | 1162 | { |
ram54288 | 0:dbad57390bd1 | 1163 | TEST_ASSERT_UINT8_WITHIN(5, 0x123, 0xF23); |
ram54288 | 0:dbad57390bd1 | 1164 | } |
ram54288 | 0:dbad57390bd1 | 1165 | |
ram54288 | 0:dbad57390bd1 | 1166 | void testUINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1167 | { |
ram54288 | 0:dbad57390bd1 | 1168 | TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1169 | } |
ram54288 | 0:dbad57390bd1 | 1170 | |
ram54288 | 0:dbad57390bd1 | 1171 | void testUINT8sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1172 | { |
ram54288 | 0:dbad57390bd1 | 1173 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1174 | TEST_ASSERT_UINT8_WITHIN(2, 255, 0); |
ram54288 | 0:dbad57390bd1 | 1175 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1176 | } |
ram54288 | 0:dbad57390bd1 | 1177 | |
ram54288 | 0:dbad57390bd1 | 1178 | void testUINT8sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1179 | { |
ram54288 | 0:dbad57390bd1 | 1180 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1181 | TEST_ASSERT_UINT8_WITHIN_MESSAGE(2, 255, 0, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1182 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1183 | } |
ram54288 | 0:dbad57390bd1 | 1184 | |
ram54288 | 0:dbad57390bd1 | 1185 | void testINT32sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1186 | { |
ram54288 | 0:dbad57390bd1 | 1187 | TEST_ASSERT_INT32_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 1188 | TEST_ASSERT_INT32_WITHIN(5, 1, -2); |
ram54288 | 0:dbad57390bd1 | 1189 | TEST_ASSERT_INT32_WITHIN(5, -2, 1); |
ram54288 | 0:dbad57390bd1 | 1190 | } |
ram54288 | 0:dbad57390bd1 | 1191 | |
ram54288 | 0:dbad57390bd1 | 1192 | void testINT32sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1193 | { |
ram54288 | 0:dbad57390bd1 | 1194 | TEST_ASSERT_INT32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1195 | } |
ram54288 | 0:dbad57390bd1 | 1196 | |
ram54288 | 0:dbad57390bd1 | 1197 | void testINT32sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1198 | { |
ram54288 | 0:dbad57390bd1 | 1199 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1200 | TEST_ASSERT_INT32_WITHIN(1, -3, 1); |
ram54288 | 0:dbad57390bd1 | 1201 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1202 | } |
ram54288 | 0:dbad57390bd1 | 1203 | |
ram54288 | 0:dbad57390bd1 | 1204 | void testINT32sNotWithinDeltaAndDifferenceOverflows(void) |
ram54288 | 0:dbad57390bd1 | 1205 | { |
ram54288 | 0:dbad57390bd1 | 1206 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1207 | TEST_ASSERT_INT32_WITHIN(1, -1, 0x7FFFFFFF); |
ram54288 | 0:dbad57390bd1 | 1208 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1209 | } |
ram54288 | 0:dbad57390bd1 | 1210 | void testINT32sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1211 | { |
ram54288 | 0:dbad57390bd1 | 1212 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1213 | TEST_ASSERT_INT32_WITHIN_MESSAGE(1, -2, 1, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1214 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1215 | } |
ram54288 | 0:dbad57390bd1 | 1216 | |
ram54288 | 0:dbad57390bd1 | 1217 | void testINT16sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1218 | { |
ram54288 | 0:dbad57390bd1 | 1219 | TEST_ASSERT_INT16_WITHIN(1, 5000, 5001); |
ram54288 | 0:dbad57390bd1 | 1220 | TEST_ASSERT_INT16_WITHIN(5, 2, -2); |
ram54288 | 0:dbad57390bd1 | 1221 | TEST_ASSERT_INT16_WITHIN(5, -2, 2); |
ram54288 | 0:dbad57390bd1 | 1222 | } |
ram54288 | 0:dbad57390bd1 | 1223 | |
ram54288 | 0:dbad57390bd1 | 1224 | void testINT16sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1225 | { |
ram54288 | 0:dbad57390bd1 | 1226 | TEST_ASSERT_INT16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1227 | } |
ram54288 | 0:dbad57390bd1 | 1228 | |
ram54288 | 0:dbad57390bd1 | 1229 | void testINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void) |
ram54288 | 0:dbad57390bd1 | 1230 | { |
ram54288 | 0:dbad57390bd1 | 1231 | TEST_ASSERT_INT16_WITHIN(5, 0x54321, 0x44321); |
ram54288 | 0:dbad57390bd1 | 1232 | } |
ram54288 | 0:dbad57390bd1 | 1233 | |
ram54288 | 0:dbad57390bd1 | 1234 | void testINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1235 | { |
ram54288 | 0:dbad57390bd1 | 1236 | TEST_ASSERT_INT16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1237 | } |
ram54288 | 0:dbad57390bd1 | 1238 | |
ram54288 | 0:dbad57390bd1 | 1239 | void testINT16sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1240 | { |
ram54288 | 0:dbad57390bd1 | 1241 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1242 | TEST_ASSERT_INT16_WITHIN(2, 4, -2); |
ram54288 | 0:dbad57390bd1 | 1243 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1244 | } |
ram54288 | 0:dbad57390bd1 | 1245 | |
ram54288 | 0:dbad57390bd1 | 1246 | void testINT16sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1247 | { |
ram54288 | 0:dbad57390bd1 | 1248 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1249 | TEST_ASSERT_INT16_WITHIN_MESSAGE(2, 3, 0, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1250 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1251 | } |
ram54288 | 0:dbad57390bd1 | 1252 | |
ram54288 | 0:dbad57390bd1 | 1253 | void testINT8sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1254 | { |
ram54288 | 0:dbad57390bd1 | 1255 | TEST_ASSERT_INT8_WITHIN(1, 127, 126); |
ram54288 | 0:dbad57390bd1 | 1256 | TEST_ASSERT_INT8_WITHIN(5, -2, 2); |
ram54288 | 0:dbad57390bd1 | 1257 | TEST_ASSERT_INT8_WITHIN(5, 2, -2); |
ram54288 | 0:dbad57390bd1 | 1258 | } |
ram54288 | 0:dbad57390bd1 | 1259 | |
ram54288 | 0:dbad57390bd1 | 1260 | void testINT8sWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1261 | { |
ram54288 | 0:dbad57390bd1 | 1262 | TEST_ASSERT_INT8_WITHIN_MESSAGE(5, 1, 4, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1263 | } |
ram54288 | 0:dbad57390bd1 | 1264 | |
ram54288 | 0:dbad57390bd1 | 1265 | void testINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void) |
ram54288 | 0:dbad57390bd1 | 1266 | { |
ram54288 | 0:dbad57390bd1 | 1267 | TEST_ASSERT_INT8_WITHIN(5, 0x123, 0xF23); |
ram54288 | 0:dbad57390bd1 | 1268 | } |
ram54288 | 0:dbad57390bd1 | 1269 | |
ram54288 | 0:dbad57390bd1 | 1270 | void testINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1271 | { |
ram54288 | 0:dbad57390bd1 | 1272 | TEST_ASSERT_INT8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1273 | } |
ram54288 | 0:dbad57390bd1 | 1274 | |
ram54288 | 0:dbad57390bd1 | 1275 | void testINT8sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 1276 | { |
ram54288 | 0:dbad57390bd1 | 1277 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1278 | TEST_ASSERT_INT8_WITHIN(2, -3, 0); |
ram54288 | 0:dbad57390bd1 | 1279 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1280 | } |
ram54288 | 0:dbad57390bd1 | 1281 | |
ram54288 | 0:dbad57390bd1 | 1282 | void testINT8sNotWithinDeltaAndCustomMessage(void) |
ram54288 | 0:dbad57390bd1 | 1283 | { |
ram54288 | 0:dbad57390bd1 | 1284 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1285 | TEST_ASSERT_INT8_WITHIN_MESSAGE(2, -4, 0, "Custom Message."); |
ram54288 | 0:dbad57390bd1 | 1286 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1287 | } |
ram54288 | 0:dbad57390bd1 | 1288 | |
ram54288 | 0:dbad57390bd1 | 1289 | void testEqualStrings(void) |
ram54288 | 0:dbad57390bd1 | 1290 | { |
ram54288 | 0:dbad57390bd1 | 1291 | const char *testString = "foo"; |
ram54288 | 0:dbad57390bd1 | 1292 | |
ram54288 | 0:dbad57390bd1 | 1293 | TEST_ASSERT_EQUAL_STRING(testString, testString); |
ram54288 | 0:dbad57390bd1 | 1294 | TEST_ASSERT_EQUAL_STRING_MESSAGE("foo", "foo", "foo isn't foo"); |
ram54288 | 0:dbad57390bd1 | 1295 | TEST_ASSERT_EQUAL_STRING("foo", testString); |
ram54288 | 0:dbad57390bd1 | 1296 | TEST_ASSERT_EQUAL_STRING(testString, "foo"); |
ram54288 | 0:dbad57390bd1 | 1297 | TEST_ASSERT_EQUAL_STRING("", ""); |
ram54288 | 0:dbad57390bd1 | 1298 | } |
ram54288 | 0:dbad57390bd1 | 1299 | |
ram54288 | 0:dbad57390bd1 | 1300 | void testEqualStringsLen(void) |
ram54288 | 0:dbad57390bd1 | 1301 | { |
ram54288 | 0:dbad57390bd1 | 1302 | const char *testString = "foobar"; |
ram54288 | 0:dbad57390bd1 | 1303 | TEST_ASSERT_EQUAL_STRING_LEN(testString, testString, strlen(testString)); |
ram54288 | 0:dbad57390bd1 | 1304 | TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE("foobar", "foobaz", 5, "fooba isn't fooba"); |
ram54288 | 0:dbad57390bd1 | 1305 | TEST_ASSERT_EQUAL_STRING_LEN("foo", testString, 3); |
ram54288 | 0:dbad57390bd1 | 1306 | TEST_ASSERT_EQUAL_STRING_LEN(testString, "foo", 3); |
ram54288 | 0:dbad57390bd1 | 1307 | TEST_ASSERT_EQUAL_STRING_LEN("", "", 3); |
ram54288 | 0:dbad57390bd1 | 1308 | } |
ram54288 | 0:dbad57390bd1 | 1309 | |
ram54288 | 0:dbad57390bd1 | 1310 | void testEqualStringsWithCarriageReturnsAndLineFeeds(void) |
ram54288 | 0:dbad57390bd1 | 1311 | { |
ram54288 | 0:dbad57390bd1 | 1312 | const char *testString = "foo\r\nbar"; |
ram54288 | 0:dbad57390bd1 | 1313 | |
ram54288 | 0:dbad57390bd1 | 1314 | TEST_ASSERT_EQUAL_STRING(testString, testString); |
ram54288 | 0:dbad57390bd1 | 1315 | TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); |
ram54288 | 0:dbad57390bd1 | 1316 | TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); |
ram54288 | 0:dbad57390bd1 | 1317 | TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); |
ram54288 | 0:dbad57390bd1 | 1318 | TEST_ASSERT_EQUAL_STRING("", ""); |
ram54288 | 0:dbad57390bd1 | 1319 | } |
ram54288 | 0:dbad57390bd1 | 1320 | |
ram54288 | 0:dbad57390bd1 | 1321 | void testNotEqualString1(void) |
ram54288 | 0:dbad57390bd1 | 1322 | { |
ram54288 | 0:dbad57390bd1 | 1323 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1324 | TEST_ASSERT_EQUAL_STRING("foo", "bar"); |
ram54288 | 0:dbad57390bd1 | 1325 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1326 | } |
ram54288 | 0:dbad57390bd1 | 1327 | |
ram54288 | 0:dbad57390bd1 | 1328 | void testNotEqualStringLen1(void) |
ram54288 | 0:dbad57390bd1 | 1329 | { |
ram54288 | 0:dbad57390bd1 | 1330 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1331 | TEST_ASSERT_EQUAL_STRING_LEN("foobar", "foobaz", 6); |
ram54288 | 0:dbad57390bd1 | 1332 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1333 | } |
ram54288 | 0:dbad57390bd1 | 1334 | |
ram54288 | 0:dbad57390bd1 | 1335 | void testNotEqualString2(void) |
ram54288 | 0:dbad57390bd1 | 1336 | { |
ram54288 | 0:dbad57390bd1 | 1337 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1338 | TEST_ASSERT_EQUAL_STRING("foo", ""); |
ram54288 | 0:dbad57390bd1 | 1339 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1340 | } |
ram54288 | 0:dbad57390bd1 | 1341 | |
ram54288 | 0:dbad57390bd1 | 1342 | void testNotEqualStringLen2(void) |
ram54288 | 0:dbad57390bd1 | 1343 | { |
ram54288 | 0:dbad57390bd1 | 1344 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1345 | TEST_ASSERT_EQUAL_STRING_LEN("foo", "", 3); |
ram54288 | 0:dbad57390bd1 | 1346 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1347 | } |
ram54288 | 0:dbad57390bd1 | 1348 | |
ram54288 | 0:dbad57390bd1 | 1349 | void testNotEqualString3(void) |
ram54288 | 0:dbad57390bd1 | 1350 | { |
ram54288 | 0:dbad57390bd1 | 1351 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1352 | TEST_ASSERT_EQUAL_STRING("", "bar"); |
ram54288 | 0:dbad57390bd1 | 1353 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1354 | } |
ram54288 | 0:dbad57390bd1 | 1355 | |
ram54288 | 0:dbad57390bd1 | 1356 | void testNotEqualStringLen3(void) |
ram54288 | 0:dbad57390bd1 | 1357 | { |
ram54288 | 0:dbad57390bd1 | 1358 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1359 | TEST_ASSERT_EQUAL_STRING_LEN("", "bar", 3); |
ram54288 | 0:dbad57390bd1 | 1360 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1361 | } |
ram54288 | 0:dbad57390bd1 | 1362 | |
ram54288 | 0:dbad57390bd1 | 1363 | void testNotEqualString4(void) |
ram54288 | 0:dbad57390bd1 | 1364 | { |
ram54288 | 0:dbad57390bd1 | 1365 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1366 | TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); |
ram54288 | 0:dbad57390bd1 | 1367 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1368 | } |
ram54288 | 0:dbad57390bd1 | 1369 | |
ram54288 | 0:dbad57390bd1 | 1370 | void testNotEqualStringLen4(void) |
ram54288 | 0:dbad57390bd1 | 1371 | { |
ram54288 | 0:dbad57390bd1 | 1372 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1373 | TEST_ASSERT_EQUAL_STRING_LEN("\r\x16", "bar\n", 4); |
ram54288 | 0:dbad57390bd1 | 1374 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1375 | } |
ram54288 | 0:dbad57390bd1 | 1376 | |
ram54288 | 0:dbad57390bd1 | 1377 | void testNotEqualString5(void) |
ram54288 | 0:dbad57390bd1 | 1378 | { |
ram54288 | 0:dbad57390bd1 | 1379 | const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; |
ram54288 | 0:dbad57390bd1 | 1380 | const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; |
ram54288 | 0:dbad57390bd1 | 1381 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1382 | TEST_ASSERT_EQUAL_STRING(str1, str2); |
ram54288 | 0:dbad57390bd1 | 1383 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1384 | } |
ram54288 | 0:dbad57390bd1 | 1385 | |
ram54288 | 0:dbad57390bd1 | 1386 | void testNotEqualString_ExpectedStringIsNull(void) |
ram54288 | 0:dbad57390bd1 | 1387 | { |
ram54288 | 0:dbad57390bd1 | 1388 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1389 | TEST_ASSERT_EQUAL_STRING(NULL, "bar"); |
ram54288 | 0:dbad57390bd1 | 1390 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1391 | } |
ram54288 | 0:dbad57390bd1 | 1392 | |
ram54288 | 0:dbad57390bd1 | 1393 | void testNotEqualStringLen_ExpectedStringIsNull(void) |
ram54288 | 0:dbad57390bd1 | 1394 | { |
ram54288 | 0:dbad57390bd1 | 1395 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1396 | TEST_ASSERT_EQUAL_STRING_LEN(NULL, "bar", 1); |
ram54288 | 0:dbad57390bd1 | 1397 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1398 | } |
ram54288 | 0:dbad57390bd1 | 1399 | |
ram54288 | 0:dbad57390bd1 | 1400 | void testNotEqualString_ActualStringIsNull(void) |
ram54288 | 0:dbad57390bd1 | 1401 | { |
ram54288 | 0:dbad57390bd1 | 1402 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1403 | TEST_ASSERT_EQUAL_STRING("foo", NULL); |
ram54288 | 0:dbad57390bd1 | 1404 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1405 | } |
ram54288 | 0:dbad57390bd1 | 1406 | |
ram54288 | 0:dbad57390bd1 | 1407 | void testNotEqualStringLen_ActualStringIsNull(void) |
ram54288 | 0:dbad57390bd1 | 1408 | { |
ram54288 | 0:dbad57390bd1 | 1409 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1410 | TEST_ASSERT_EQUAL_STRING_LEN("foo", NULL, 1); |
ram54288 | 0:dbad57390bd1 | 1411 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1412 | } |
ram54288 | 0:dbad57390bd1 | 1413 | |
ram54288 | 0:dbad57390bd1 | 1414 | void testEqualStringArrays(void) |
ram54288 | 0:dbad57390bd1 | 1415 | { |
ram54288 | 0:dbad57390bd1 | 1416 | const char *testStrings[] = { "foo", "boo", "woo", "moo" }; |
ram54288 | 0:dbad57390bd1 | 1417 | const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; |
ram54288 | 0:dbad57390bd1 | 1418 | |
ram54288 | 0:dbad57390bd1 | 1419 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); |
ram54288 | 0:dbad57390bd1 | 1420 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); |
ram54288 | 0:dbad57390bd1 | 1421 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); |
ram54288 | 0:dbad57390bd1 | 1422 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); |
ram54288 | 0:dbad57390bd1 | 1423 | } |
ram54288 | 0:dbad57390bd1 | 1424 | |
ram54288 | 0:dbad57390bd1 | 1425 | void testNotEqualStringArray1(void) |
ram54288 | 0:dbad57390bd1 | 1426 | { |
ram54288 | 0:dbad57390bd1 | 1427 | const char *testStrings[] = { "foo", "boo", "woo", "moo" }; |
ram54288 | 0:dbad57390bd1 | 1428 | const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; |
ram54288 | 0:dbad57390bd1 | 1429 | |
ram54288 | 0:dbad57390bd1 | 1430 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1431 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1432 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1433 | } |
ram54288 | 0:dbad57390bd1 | 1434 | |
ram54288 | 0:dbad57390bd1 | 1435 | void testNotEqualStringArray2(void) |
ram54288 | 0:dbad57390bd1 | 1436 | { |
ram54288 | 0:dbad57390bd1 | 1437 | const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; |
ram54288 | 0:dbad57390bd1 | 1438 | const char *expStrings[] = { "foo", "boo", "woo", "moo" }; |
ram54288 | 0:dbad57390bd1 | 1439 | |
ram54288 | 0:dbad57390bd1 | 1440 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1441 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1442 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1443 | } |
ram54288 | 0:dbad57390bd1 | 1444 | |
ram54288 | 0:dbad57390bd1 | 1445 | void testNotEqualStringArray3(void) |
ram54288 | 0:dbad57390bd1 | 1446 | { |
ram54288 | 0:dbad57390bd1 | 1447 | const char *testStrings[] = { "foo", "boo", "woo", NULL }; |
ram54288 | 0:dbad57390bd1 | 1448 | const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; |
ram54288 | 0:dbad57390bd1 | 1449 | |
ram54288 | 0:dbad57390bd1 | 1450 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1451 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1452 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1453 | } |
ram54288 | 0:dbad57390bd1 | 1454 | |
ram54288 | 0:dbad57390bd1 | 1455 | void testNotEqualStringArray4(void) |
ram54288 | 0:dbad57390bd1 | 1456 | { |
ram54288 | 0:dbad57390bd1 | 1457 | const char *testStrings[] = { "foo", "boo", "woo", "moo" }; |
ram54288 | 0:dbad57390bd1 | 1458 | const char *expStrings[] = { "foo", NULL, "woo", "moo" }; |
ram54288 | 0:dbad57390bd1 | 1459 | |
ram54288 | 0:dbad57390bd1 | 1460 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1461 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1462 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1463 | } |
ram54288 | 0:dbad57390bd1 | 1464 | |
ram54288 | 0:dbad57390bd1 | 1465 | void testNotEqualStringArray5(void) |
ram54288 | 0:dbad57390bd1 | 1466 | { |
ram54288 | 0:dbad57390bd1 | 1467 | const char **testStrings = NULL; |
ram54288 | 0:dbad57390bd1 | 1468 | const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; |
ram54288 | 0:dbad57390bd1 | 1469 | |
ram54288 | 0:dbad57390bd1 | 1470 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1471 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1472 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1473 | } |
ram54288 | 0:dbad57390bd1 | 1474 | |
ram54288 | 0:dbad57390bd1 | 1475 | void testNotEqualStringArray6(void) |
ram54288 | 0:dbad57390bd1 | 1476 | { |
ram54288 | 0:dbad57390bd1 | 1477 | const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; |
ram54288 | 0:dbad57390bd1 | 1478 | const char **expStrings = NULL; |
ram54288 | 0:dbad57390bd1 | 1479 | |
ram54288 | 0:dbad57390bd1 | 1480 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1481 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1482 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1483 | } |
ram54288 | 0:dbad57390bd1 | 1484 | |
ram54288 | 0:dbad57390bd1 | 1485 | void testEqualStringArrayIfBothNulls(void) |
ram54288 | 0:dbad57390bd1 | 1486 | { |
ram54288 | 0:dbad57390bd1 | 1487 | const char **testStrings = NULL; |
ram54288 | 0:dbad57390bd1 | 1488 | const char **expStrings = NULL; |
ram54288 | 0:dbad57390bd1 | 1489 | |
ram54288 | 0:dbad57390bd1 | 1490 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); |
ram54288 | 0:dbad57390bd1 | 1491 | } |
ram54288 | 0:dbad57390bd1 | 1492 | |
ram54288 | 0:dbad57390bd1 | 1493 | void testNotEqualStringArrayLengthZero(void) |
ram54288 | 0:dbad57390bd1 | 1494 | { |
ram54288 | 0:dbad57390bd1 | 1495 | const char *testStrings[] = {NULL}; |
ram54288 | 0:dbad57390bd1 | 1496 | const char **expStrings = NULL; |
ram54288 | 0:dbad57390bd1 | 1497 | |
ram54288 | 0:dbad57390bd1 | 1498 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1499 | TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 0); |
ram54288 | 0:dbad57390bd1 | 1500 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1501 | } |
ram54288 | 0:dbad57390bd1 | 1502 | |
ram54288 | 0:dbad57390bd1 | 1503 | void testEqualMemory(void) |
ram54288 | 0:dbad57390bd1 | 1504 | { |
ram54288 | 0:dbad57390bd1 | 1505 | const char *testString = "whatever"; |
ram54288 | 0:dbad57390bd1 | 1506 | |
ram54288 | 0:dbad57390bd1 | 1507 | TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); |
ram54288 | 0:dbad57390bd1 | 1508 | TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); |
ram54288 | 0:dbad57390bd1 | 1509 | TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); |
ram54288 | 0:dbad57390bd1 | 1510 | TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); |
ram54288 | 0:dbad57390bd1 | 1511 | TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); |
ram54288 | 0:dbad57390bd1 | 1512 | TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); |
ram54288 | 0:dbad57390bd1 | 1513 | } |
ram54288 | 0:dbad57390bd1 | 1514 | |
ram54288 | 0:dbad57390bd1 | 1515 | void testNotEqualMemory1(void) |
ram54288 | 0:dbad57390bd1 | 1516 | { |
ram54288 | 0:dbad57390bd1 | 1517 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1518 | TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); |
ram54288 | 0:dbad57390bd1 | 1519 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1520 | } |
ram54288 | 0:dbad57390bd1 | 1521 | |
ram54288 | 0:dbad57390bd1 | 1522 | void testNotEqualMemory2(void) |
ram54288 | 0:dbad57390bd1 | 1523 | { |
ram54288 | 0:dbad57390bd1 | 1524 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1525 | TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); |
ram54288 | 0:dbad57390bd1 | 1526 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1527 | } |
ram54288 | 0:dbad57390bd1 | 1528 | |
ram54288 | 0:dbad57390bd1 | 1529 | void testNotEqualMemory3(void) |
ram54288 | 0:dbad57390bd1 | 1530 | { |
ram54288 | 0:dbad57390bd1 | 1531 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1532 | TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); |
ram54288 | 0:dbad57390bd1 | 1533 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1534 | } |
ram54288 | 0:dbad57390bd1 | 1535 | |
ram54288 | 0:dbad57390bd1 | 1536 | void testNotEqualMemory4(void) |
ram54288 | 0:dbad57390bd1 | 1537 | { |
ram54288 | 0:dbad57390bd1 | 1538 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1539 | TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); |
ram54288 | 0:dbad57390bd1 | 1540 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1541 | } |
ram54288 | 0:dbad57390bd1 | 1542 | |
ram54288 | 0:dbad57390bd1 | 1543 | void testNotEqualMemoryLengthZero(void) |
ram54288 | 0:dbad57390bd1 | 1544 | { |
ram54288 | 0:dbad57390bd1 | 1545 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1546 | TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 0); |
ram54288 | 0:dbad57390bd1 | 1547 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1548 | } |
ram54288 | 0:dbad57390bd1 | 1549 | |
ram54288 | 0:dbad57390bd1 | 1550 | void testEqualIntArrays(void) |
ram54288 | 0:dbad57390bd1 | 1551 | { |
ram54288 | 0:dbad57390bd1 | 1552 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 1553 | int p1[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 1554 | int p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1555 | int p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 1556 | |
ram54288 | 0:dbad57390bd1 | 1557 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1558 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1559 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1560 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1561 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1562 | TEST_ASSERT_EQUAL_INT_ARRAY(NULL, NULL, 1); |
ram54288 | 0:dbad57390bd1 | 1563 | } |
ram54288 | 0:dbad57390bd1 | 1564 | |
ram54288 | 0:dbad57390bd1 | 1565 | void testNotEqualIntArraysNullExpected(void) |
ram54288 | 0:dbad57390bd1 | 1566 | { |
ram54288 | 0:dbad57390bd1 | 1567 | int* p0 = NULL; |
ram54288 | 0:dbad57390bd1 | 1568 | int p1[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1569 | |
ram54288 | 0:dbad57390bd1 | 1570 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1571 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1572 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1573 | } |
ram54288 | 0:dbad57390bd1 | 1574 | |
ram54288 | 0:dbad57390bd1 | 1575 | void testNotEqualIntArraysNullActual(void) |
ram54288 | 0:dbad57390bd1 | 1576 | { |
ram54288 | 0:dbad57390bd1 | 1577 | int* p1 = NULL; |
ram54288 | 0:dbad57390bd1 | 1578 | int p0[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1579 | |
ram54288 | 0:dbad57390bd1 | 1580 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1581 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1582 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1583 | } |
ram54288 | 0:dbad57390bd1 | 1584 | |
ram54288 | 0:dbad57390bd1 | 1585 | void testNotEqualIntArrays1(void) |
ram54288 | 0:dbad57390bd1 | 1586 | { |
ram54288 | 0:dbad57390bd1 | 1587 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 1588 | int p1[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1589 | |
ram54288 | 0:dbad57390bd1 | 1590 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1591 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1592 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1593 | } |
ram54288 | 0:dbad57390bd1 | 1594 | |
ram54288 | 0:dbad57390bd1 | 1595 | void testNotEqualIntArrays2(void) |
ram54288 | 0:dbad57390bd1 | 1596 | { |
ram54288 | 0:dbad57390bd1 | 1597 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 1598 | int p1[] = {2, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 1599 | |
ram54288 | 0:dbad57390bd1 | 1600 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1601 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1602 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1603 | } |
ram54288 | 0:dbad57390bd1 | 1604 | |
ram54288 | 0:dbad57390bd1 | 1605 | void testNotEqualIntArrays3(void) |
ram54288 | 0:dbad57390bd1 | 1606 | { |
ram54288 | 0:dbad57390bd1 | 1607 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 1608 | int p1[] = {1, 8, 986, -2}; |
ram54288 | 0:dbad57390bd1 | 1609 | |
ram54288 | 0:dbad57390bd1 | 1610 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1611 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1612 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1613 | } |
ram54288 | 0:dbad57390bd1 | 1614 | |
ram54288 | 0:dbad57390bd1 | 1615 | void testNotEqualIntArraysLengthZero(void) |
ram54288 | 0:dbad57390bd1 | 1616 | { |
ram54288 | 0:dbad57390bd1 | 1617 | _UU32 p0[1] = {1}; |
ram54288 | 0:dbad57390bd1 | 1618 | _UU32 p1[1] = {1}; |
ram54288 | 0:dbad57390bd1 | 1619 | |
ram54288 | 0:dbad57390bd1 | 1620 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1621 | TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 0); |
ram54288 | 0:dbad57390bd1 | 1622 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1623 | } |
ram54288 | 0:dbad57390bd1 | 1624 | |
ram54288 | 0:dbad57390bd1 | 1625 | void testEqualPtrArrays(void) |
ram54288 | 0:dbad57390bd1 | 1626 | { |
ram54288 | 0:dbad57390bd1 | 1627 | char A = 1; |
ram54288 | 0:dbad57390bd1 | 1628 | char B = 2; |
ram54288 | 0:dbad57390bd1 | 1629 | char C = 3; |
ram54288 | 0:dbad57390bd1 | 1630 | char* p0[] = {&A, &B, &C}; |
ram54288 | 0:dbad57390bd1 | 1631 | char* p1[] = {&A, &B, &C, &A}; |
ram54288 | 0:dbad57390bd1 | 1632 | char* p2[] = {&A, &B}; |
ram54288 | 0:dbad57390bd1 | 1633 | char* p3[] = {&A}; |
ram54288 | 0:dbad57390bd1 | 1634 | |
ram54288 | 0:dbad57390bd1 | 1635 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1636 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p0, 3); |
ram54288 | 0:dbad57390bd1 | 1637 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 3); |
ram54288 | 0:dbad57390bd1 | 1638 | TEST_ASSERT_EQUAL_PTR_ARRAY(p1, p2, 2); |
ram54288 | 0:dbad57390bd1 | 1639 | TEST_ASSERT_EQUAL_PTR_ARRAY(p3, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1640 | } |
ram54288 | 0:dbad57390bd1 | 1641 | |
ram54288 | 0:dbad57390bd1 | 1642 | void testNotEqualPtrArraysNullExpected(void) |
ram54288 | 0:dbad57390bd1 | 1643 | { |
ram54288 | 0:dbad57390bd1 | 1644 | char A = 1; |
ram54288 | 0:dbad57390bd1 | 1645 | char B = 2; |
ram54288 | 0:dbad57390bd1 | 1646 | char** p0 = NULL; |
ram54288 | 0:dbad57390bd1 | 1647 | char* p1[] = {&A, &B}; |
ram54288 | 0:dbad57390bd1 | 1648 | |
ram54288 | 0:dbad57390bd1 | 1649 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1650 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 2); |
ram54288 | 0:dbad57390bd1 | 1651 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1652 | } |
ram54288 | 0:dbad57390bd1 | 1653 | |
ram54288 | 0:dbad57390bd1 | 1654 | void testNotEqualPtrArraysNullActual(void) |
ram54288 | 0:dbad57390bd1 | 1655 | { |
ram54288 | 0:dbad57390bd1 | 1656 | char A = 1; |
ram54288 | 0:dbad57390bd1 | 1657 | char B = 2; |
ram54288 | 0:dbad57390bd1 | 1658 | char** p0 = NULL; |
ram54288 | 0:dbad57390bd1 | 1659 | char* p1[] = {&A, &B}; |
ram54288 | 0:dbad57390bd1 | 1660 | |
ram54288 | 0:dbad57390bd1 | 1661 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1662 | TEST_ASSERT_EQUAL_PTR_ARRAY(p1, p0, 2); |
ram54288 | 0:dbad57390bd1 | 1663 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1664 | } |
ram54288 | 0:dbad57390bd1 | 1665 | |
ram54288 | 0:dbad57390bd1 | 1666 | void testNotEqualPtrArrays1(void) |
ram54288 | 0:dbad57390bd1 | 1667 | { |
ram54288 | 0:dbad57390bd1 | 1668 | char A = 1; |
ram54288 | 0:dbad57390bd1 | 1669 | char B = 2; |
ram54288 | 0:dbad57390bd1 | 1670 | char C = 3; |
ram54288 | 0:dbad57390bd1 | 1671 | char* p0[] = {&A, &B, &C, &B}; |
ram54288 | 0:dbad57390bd1 | 1672 | char* p1[] = {&A, &B, &C, &A}; |
ram54288 | 0:dbad57390bd1 | 1673 | |
ram54288 | 0:dbad57390bd1 | 1674 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1675 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1676 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1677 | } |
ram54288 | 0:dbad57390bd1 | 1678 | |
ram54288 | 0:dbad57390bd1 | 1679 | void testNotEqualPtrArrays2(void) |
ram54288 | 0:dbad57390bd1 | 1680 | { |
ram54288 | 0:dbad57390bd1 | 1681 | char A = 1; |
ram54288 | 0:dbad57390bd1 | 1682 | char B = 2; |
ram54288 | 0:dbad57390bd1 | 1683 | char C = 3; |
ram54288 | 0:dbad57390bd1 | 1684 | char* p0[] = {&B, &B, &C, &A}; |
ram54288 | 0:dbad57390bd1 | 1685 | char* p1[] = {&A, &B, &C, &A}; |
ram54288 | 0:dbad57390bd1 | 1686 | |
ram54288 | 0:dbad57390bd1 | 1687 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1688 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1689 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1690 | } |
ram54288 | 0:dbad57390bd1 | 1691 | |
ram54288 | 0:dbad57390bd1 | 1692 | void testNotEqualPtrArrays3(void) |
ram54288 | 0:dbad57390bd1 | 1693 | { |
ram54288 | 0:dbad57390bd1 | 1694 | char A = 1; |
ram54288 | 0:dbad57390bd1 | 1695 | char B = 2; |
ram54288 | 0:dbad57390bd1 | 1696 | char C = 3; |
ram54288 | 0:dbad57390bd1 | 1697 | char* p0[] = {&A, &B, &B, &A}; |
ram54288 | 0:dbad57390bd1 | 1698 | char* p1[] = {&A, &B, &C, &A}; |
ram54288 | 0:dbad57390bd1 | 1699 | |
ram54288 | 0:dbad57390bd1 | 1700 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1701 | TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1702 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1703 | } |
ram54288 | 0:dbad57390bd1 | 1704 | |
ram54288 | 0:dbad57390bd1 | 1705 | void testEqualInt8Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1706 | { |
ram54288 | 0:dbad57390bd1 | 1707 | _US8 p0[] = {1, 8, 117, -2}; |
ram54288 | 0:dbad57390bd1 | 1708 | _US8 p1[] = {1, 8, 117, -2}; |
ram54288 | 0:dbad57390bd1 | 1709 | _US8 p2[] = {1, 8, 117, 2}; |
ram54288 | 0:dbad57390bd1 | 1710 | _US8 p3[] = {1, 50, 60, 70}; |
ram54288 | 0:dbad57390bd1 | 1711 | |
ram54288 | 0:dbad57390bd1 | 1712 | TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1713 | TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1714 | TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1715 | TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1716 | TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1717 | } |
ram54288 | 0:dbad57390bd1 | 1718 | |
ram54288 | 0:dbad57390bd1 | 1719 | void testNotEqualInt8Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1720 | { |
ram54288 | 0:dbad57390bd1 | 1721 | _US8 p0[] = {1, 8, 36, -2}; |
ram54288 | 0:dbad57390bd1 | 1722 | _US8 p1[] = {1, 8, 36, 2}; |
ram54288 | 0:dbad57390bd1 | 1723 | |
ram54288 | 0:dbad57390bd1 | 1724 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1725 | TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1726 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1727 | } |
ram54288 | 0:dbad57390bd1 | 1728 | |
ram54288 | 0:dbad57390bd1 | 1729 | void testEqualUIntArrays(void) |
ram54288 | 0:dbad57390bd1 | 1730 | { |
ram54288 | 0:dbad57390bd1 | 1731 | unsigned int p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1732 | unsigned int p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1733 | unsigned int p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1734 | unsigned int p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 1735 | |
ram54288 | 0:dbad57390bd1 | 1736 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1737 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1738 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1739 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1740 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1741 | } |
ram54288 | 0:dbad57390bd1 | 1742 | |
ram54288 | 0:dbad57390bd1 | 1743 | void testNotEqualUIntArrays1(void) |
ram54288 | 0:dbad57390bd1 | 1744 | { |
ram54288 | 0:dbad57390bd1 | 1745 | unsigned int p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1746 | unsigned int p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 1747 | |
ram54288 | 0:dbad57390bd1 | 1748 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1749 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1750 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1751 | } |
ram54288 | 0:dbad57390bd1 | 1752 | |
ram54288 | 0:dbad57390bd1 | 1753 | void testNotEqualUIntArrays2(void) |
ram54288 | 0:dbad57390bd1 | 1754 | { |
ram54288 | 0:dbad57390bd1 | 1755 | unsigned int p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1756 | unsigned int p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1757 | |
ram54288 | 0:dbad57390bd1 | 1758 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1759 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1760 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1761 | } |
ram54288 | 0:dbad57390bd1 | 1762 | |
ram54288 | 0:dbad57390bd1 | 1763 | void testNotEqualUIntArrays3(void) |
ram54288 | 0:dbad57390bd1 | 1764 | { |
ram54288 | 0:dbad57390bd1 | 1765 | unsigned int p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1766 | unsigned int p1[] = {1, 8, 986, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1767 | |
ram54288 | 0:dbad57390bd1 | 1768 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1769 | TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1770 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1771 | } |
ram54288 | 0:dbad57390bd1 | 1772 | |
ram54288 | 0:dbad57390bd1 | 1773 | void testEqualInt16Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1774 | { |
ram54288 | 0:dbad57390bd1 | 1775 | _US16 p0[] = {1, 8, 117, 3}; |
ram54288 | 0:dbad57390bd1 | 1776 | _US16 p1[] = {1, 8, 117, 3}; |
ram54288 | 0:dbad57390bd1 | 1777 | _US16 p2[] = {1, 8, 117, 2}; |
ram54288 | 0:dbad57390bd1 | 1778 | _US16 p3[] = {1, 50, 60, 70}; |
ram54288 | 0:dbad57390bd1 | 1779 | |
ram54288 | 0:dbad57390bd1 | 1780 | TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1781 | TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1782 | TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1783 | TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1784 | TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1785 | } |
ram54288 | 0:dbad57390bd1 | 1786 | |
ram54288 | 0:dbad57390bd1 | 1787 | void testNotEqualInt16Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1788 | { |
ram54288 | 0:dbad57390bd1 | 1789 | _US16 p0[] = {1, 8, 127, 3}; |
ram54288 | 0:dbad57390bd1 | 1790 | _US16 p1[] = {1, 8, 127, 2}; |
ram54288 | 0:dbad57390bd1 | 1791 | |
ram54288 | 0:dbad57390bd1 | 1792 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1793 | TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1794 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1795 | } |
ram54288 | 0:dbad57390bd1 | 1796 | |
ram54288 | 0:dbad57390bd1 | 1797 | void testEqualInt32Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1798 | { |
ram54288 | 0:dbad57390bd1 | 1799 | _US32 p0[] = {1, 8, 117, 3}; |
ram54288 | 0:dbad57390bd1 | 1800 | _US32 p1[] = {1, 8, 117, 3}; |
ram54288 | 0:dbad57390bd1 | 1801 | _US32 p2[] = {1, 8, 117, 2}; |
ram54288 | 0:dbad57390bd1 | 1802 | _US32 p3[] = {1, 50, 60, 70}; |
ram54288 | 0:dbad57390bd1 | 1803 | |
ram54288 | 0:dbad57390bd1 | 1804 | TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1805 | TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1806 | TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1807 | TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1808 | TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1809 | } |
ram54288 | 0:dbad57390bd1 | 1810 | |
ram54288 | 0:dbad57390bd1 | 1811 | void testNotEqualInt32Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1812 | { |
ram54288 | 0:dbad57390bd1 | 1813 | _US32 p0[] = {1, 8, 127, 3}; |
ram54288 | 0:dbad57390bd1 | 1814 | _US32 p1[] = {1, 8, 127, 2}; |
ram54288 | 0:dbad57390bd1 | 1815 | |
ram54288 | 0:dbad57390bd1 | 1816 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1817 | TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1818 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1819 | } |
ram54288 | 0:dbad57390bd1 | 1820 | |
ram54288 | 0:dbad57390bd1 | 1821 | void testEqualUINT8Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1822 | { |
ram54288 | 0:dbad57390bd1 | 1823 | _UU8 p0[] = {1, 8, 100, 127}; |
ram54288 | 0:dbad57390bd1 | 1824 | _UU8 p1[] = {1, 8, 100, 127}; |
ram54288 | 0:dbad57390bd1 | 1825 | _UU8 p2[] = {1, 8, 100, 2}; |
ram54288 | 0:dbad57390bd1 | 1826 | _UU8 p3[] = {1, 50, 60, 70}; |
ram54288 | 0:dbad57390bd1 | 1827 | |
ram54288 | 0:dbad57390bd1 | 1828 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1829 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1830 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1831 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1832 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1833 | } |
ram54288 | 0:dbad57390bd1 | 1834 | |
ram54288 | 0:dbad57390bd1 | 1835 | void testNotEqualUINT8Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 1836 | { |
ram54288 | 0:dbad57390bd1 | 1837 | unsigned char p0[] = {1, 8, 100, 127u}; |
ram54288 | 0:dbad57390bd1 | 1838 | unsigned char p1[] = {1, 8, 100, 255u}; |
ram54288 | 0:dbad57390bd1 | 1839 | |
ram54288 | 0:dbad57390bd1 | 1840 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1841 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1842 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1843 | } |
ram54288 | 0:dbad57390bd1 | 1844 | |
ram54288 | 0:dbad57390bd1 | 1845 | void testNotEqualUINT8Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 1846 | { |
ram54288 | 0:dbad57390bd1 | 1847 | unsigned char p0[] = {1, 8, 100, 127u}; |
ram54288 | 0:dbad57390bd1 | 1848 | unsigned char p1[] = {1, 8, 100, 255u}; |
ram54288 | 0:dbad57390bd1 | 1849 | |
ram54288 | 0:dbad57390bd1 | 1850 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1851 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1852 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1853 | } |
ram54288 | 0:dbad57390bd1 | 1854 | |
ram54288 | 0:dbad57390bd1 | 1855 | void testNotEqualUINT8Arrays3(void) |
ram54288 | 0:dbad57390bd1 | 1856 | { |
ram54288 | 0:dbad57390bd1 | 1857 | unsigned char p0[] = {1, 8, 100, 127u}; |
ram54288 | 0:dbad57390bd1 | 1858 | unsigned char p1[] = {1, 8, 100, 255u}; |
ram54288 | 0:dbad57390bd1 | 1859 | |
ram54288 | 0:dbad57390bd1 | 1860 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1861 | TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1862 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1863 | } |
ram54288 | 0:dbad57390bd1 | 1864 | |
ram54288 | 0:dbad57390bd1 | 1865 | |
ram54288 | 0:dbad57390bd1 | 1866 | void testEqualUINT16Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1867 | { |
ram54288 | 0:dbad57390bd1 | 1868 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1869 | unsigned short p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1870 | unsigned short p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1871 | unsigned short p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 1872 | |
ram54288 | 0:dbad57390bd1 | 1873 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1874 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1875 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1876 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1877 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1878 | } |
ram54288 | 0:dbad57390bd1 | 1879 | |
ram54288 | 0:dbad57390bd1 | 1880 | void testNotEqualUINT16Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 1881 | { |
ram54288 | 0:dbad57390bd1 | 1882 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1883 | unsigned short p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 1884 | |
ram54288 | 0:dbad57390bd1 | 1885 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1886 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1887 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1888 | } |
ram54288 | 0:dbad57390bd1 | 1889 | |
ram54288 | 0:dbad57390bd1 | 1890 | void testNotEqualUINT16Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 1891 | { |
ram54288 | 0:dbad57390bd1 | 1892 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1893 | unsigned short p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1894 | |
ram54288 | 0:dbad57390bd1 | 1895 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1896 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1897 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1898 | } |
ram54288 | 0:dbad57390bd1 | 1899 | |
ram54288 | 0:dbad57390bd1 | 1900 | void testNotEqualUINT16Arrays3(void) |
ram54288 | 0:dbad57390bd1 | 1901 | { |
ram54288 | 0:dbad57390bd1 | 1902 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1903 | unsigned short p1[] = {1, 8, 986, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1904 | |
ram54288 | 0:dbad57390bd1 | 1905 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1906 | TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1907 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1908 | } |
ram54288 | 0:dbad57390bd1 | 1909 | |
ram54288 | 0:dbad57390bd1 | 1910 | void testEqualUINT32Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1911 | { |
ram54288 | 0:dbad57390bd1 | 1912 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1913 | _UU32 p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1914 | _UU32 p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1915 | _UU32 p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 1916 | |
ram54288 | 0:dbad57390bd1 | 1917 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1918 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1919 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1920 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1921 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1922 | } |
ram54288 | 0:dbad57390bd1 | 1923 | |
ram54288 | 0:dbad57390bd1 | 1924 | void testNotEqualUINT32Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 1925 | { |
ram54288 | 0:dbad57390bd1 | 1926 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1927 | _UU32 p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 1928 | |
ram54288 | 0:dbad57390bd1 | 1929 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1930 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1931 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1932 | } |
ram54288 | 0:dbad57390bd1 | 1933 | |
ram54288 | 0:dbad57390bd1 | 1934 | void testNotEqualUINT32Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 1935 | { |
ram54288 | 0:dbad57390bd1 | 1936 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1937 | _UU32 p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1938 | |
ram54288 | 0:dbad57390bd1 | 1939 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1940 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1941 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1942 | } |
ram54288 | 0:dbad57390bd1 | 1943 | |
ram54288 | 0:dbad57390bd1 | 1944 | void testNotEqualUINT32Arrays3(void) |
ram54288 | 0:dbad57390bd1 | 1945 | { |
ram54288 | 0:dbad57390bd1 | 1946 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1947 | _UU32 p1[] = {1, 8, 986, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1948 | |
ram54288 | 0:dbad57390bd1 | 1949 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1950 | TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1951 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1952 | } |
ram54288 | 0:dbad57390bd1 | 1953 | |
ram54288 | 0:dbad57390bd1 | 1954 | void testEqualHEXArrays(void) |
ram54288 | 0:dbad57390bd1 | 1955 | { |
ram54288 | 0:dbad57390bd1 | 1956 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1957 | _UU32 p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1958 | _UU32 p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 1959 | _UU32 p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 1960 | |
ram54288 | 0:dbad57390bd1 | 1961 | TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 1962 | TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 1963 | TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1964 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 1965 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 1966 | } |
ram54288 | 0:dbad57390bd1 | 1967 | |
ram54288 | 0:dbad57390bd1 | 1968 | void testNotEqualHEXArrays1(void) |
ram54288 | 0:dbad57390bd1 | 1969 | { |
ram54288 | 0:dbad57390bd1 | 1970 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1971 | _UU32 p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 1972 | |
ram54288 | 0:dbad57390bd1 | 1973 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1974 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1975 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1976 | } |
ram54288 | 0:dbad57390bd1 | 1977 | |
ram54288 | 0:dbad57390bd1 | 1978 | void testNotEqualHEXArrays2(void) |
ram54288 | 0:dbad57390bd1 | 1979 | { |
ram54288 | 0:dbad57390bd1 | 1980 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1981 | _UU32 p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1982 | |
ram54288 | 0:dbad57390bd1 | 1983 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1984 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1985 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1986 | } |
ram54288 | 0:dbad57390bd1 | 1987 | |
ram54288 | 0:dbad57390bd1 | 1988 | void testNotEqualHEXArrays3(void) |
ram54288 | 0:dbad57390bd1 | 1989 | { |
ram54288 | 0:dbad57390bd1 | 1990 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1991 | _UU32 p1[] = {1, 8, 986, 65132u}; |
ram54288 | 0:dbad57390bd1 | 1992 | |
ram54288 | 0:dbad57390bd1 | 1993 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 1994 | TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 1995 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 1996 | } |
ram54288 | 0:dbad57390bd1 | 1997 | |
ram54288 | 0:dbad57390bd1 | 1998 | void testEqualHEX32Arrays(void) |
ram54288 | 0:dbad57390bd1 | 1999 | { |
ram54288 | 0:dbad57390bd1 | 2000 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2001 | _UU32 p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2002 | _UU32 p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2003 | _UU32 p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 2004 | |
ram54288 | 0:dbad57390bd1 | 2005 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 2006 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 2007 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2008 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 2009 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 2010 | } |
ram54288 | 0:dbad57390bd1 | 2011 | |
ram54288 | 0:dbad57390bd1 | 2012 | void testNotEqualHEX32Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 2013 | { |
ram54288 | 0:dbad57390bd1 | 2014 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2015 | _UU32 p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 2016 | |
ram54288 | 0:dbad57390bd1 | 2017 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2018 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2019 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2020 | } |
ram54288 | 0:dbad57390bd1 | 2021 | |
ram54288 | 0:dbad57390bd1 | 2022 | void testNotEqualHEX32Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 2023 | { |
ram54288 | 0:dbad57390bd1 | 2024 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2025 | _UU32 p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2026 | |
ram54288 | 0:dbad57390bd1 | 2027 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2028 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2029 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2030 | } |
ram54288 | 0:dbad57390bd1 | 2031 | |
ram54288 | 0:dbad57390bd1 | 2032 | void testNotEqualHEX32Arrays3(void) |
ram54288 | 0:dbad57390bd1 | 2033 | { |
ram54288 | 0:dbad57390bd1 | 2034 | _UU32 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2035 | _UU32 p1[] = {1, 8, 986, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2036 | |
ram54288 | 0:dbad57390bd1 | 2037 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2038 | TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2039 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2040 | } |
ram54288 | 0:dbad57390bd1 | 2041 | |
ram54288 | 0:dbad57390bd1 | 2042 | void testEqualHEX16Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2043 | { |
ram54288 | 0:dbad57390bd1 | 2044 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2045 | unsigned short p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2046 | unsigned short p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2047 | unsigned short p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 2048 | |
ram54288 | 0:dbad57390bd1 | 2049 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 2050 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 2051 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2052 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 2053 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 2054 | } |
ram54288 | 0:dbad57390bd1 | 2055 | |
ram54288 | 0:dbad57390bd1 | 2056 | void testNotEqualHEX16Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 2057 | { |
ram54288 | 0:dbad57390bd1 | 2058 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2059 | unsigned short p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 2060 | |
ram54288 | 0:dbad57390bd1 | 2061 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2062 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2063 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2064 | } |
ram54288 | 0:dbad57390bd1 | 2065 | |
ram54288 | 0:dbad57390bd1 | 2066 | void testNotEqualHEX16Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 2067 | { |
ram54288 | 0:dbad57390bd1 | 2068 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2069 | unsigned short p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2070 | |
ram54288 | 0:dbad57390bd1 | 2071 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2072 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2073 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2074 | } |
ram54288 | 0:dbad57390bd1 | 2075 | |
ram54288 | 0:dbad57390bd1 | 2076 | void testNotEqualHEX16Arrays3(void) |
ram54288 | 0:dbad57390bd1 | 2077 | { |
ram54288 | 0:dbad57390bd1 | 2078 | unsigned short p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2079 | unsigned short p1[] = {1, 8, 986, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2080 | |
ram54288 | 0:dbad57390bd1 | 2081 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2082 | TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2083 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2084 | } |
ram54288 | 0:dbad57390bd1 | 2085 | |
ram54288 | 0:dbad57390bd1 | 2086 | void testEqualHEX8Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2087 | { |
ram54288 | 0:dbad57390bd1 | 2088 | unsigned short p0[] = {1, 8, 254u, 123}; |
ram54288 | 0:dbad57390bd1 | 2089 | unsigned short p1[] = {1, 8, 254u, 123}; |
ram54288 | 0:dbad57390bd1 | 2090 | unsigned short p2[] = {1, 8, 254u, 2}; |
ram54288 | 0:dbad57390bd1 | 2091 | unsigned short p3[] = {1, 23, 25, 26}; |
ram54288 | 0:dbad57390bd1 | 2092 | |
ram54288 | 0:dbad57390bd1 | 2093 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 2094 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 2095 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2096 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 2097 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 2098 | } |
ram54288 | 0:dbad57390bd1 | 2099 | |
ram54288 | 0:dbad57390bd1 | 2100 | void testNotEqualHEX8Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 2101 | { |
ram54288 | 0:dbad57390bd1 | 2102 | unsigned char p0[] = {1, 8, 254u, 253u}; |
ram54288 | 0:dbad57390bd1 | 2103 | unsigned char p1[] = {1, 8, 254u, 252u}; |
ram54288 | 0:dbad57390bd1 | 2104 | |
ram54288 | 0:dbad57390bd1 | 2105 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2106 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2107 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2108 | } |
ram54288 | 0:dbad57390bd1 | 2109 | |
ram54288 | 0:dbad57390bd1 | 2110 | void testNotEqualHEX8Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 2111 | { |
ram54288 | 0:dbad57390bd1 | 2112 | unsigned char p0[] = {1, 8, 254u, 253u}; |
ram54288 | 0:dbad57390bd1 | 2113 | unsigned char p1[] = {2, 8, 254u, 253u}; |
ram54288 | 0:dbad57390bd1 | 2114 | |
ram54288 | 0:dbad57390bd1 | 2115 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2116 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2117 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2118 | } |
ram54288 | 0:dbad57390bd1 | 2119 | |
ram54288 | 0:dbad57390bd1 | 2120 | void testNotEqualHEX8Arrays3(void) |
ram54288 | 0:dbad57390bd1 | 2121 | { |
ram54288 | 0:dbad57390bd1 | 2122 | unsigned char p0[] = {1, 8, 254u, 253u}; |
ram54288 | 0:dbad57390bd1 | 2123 | unsigned char p1[] = {1, 8, 255u, 253u}; |
ram54288 | 0:dbad57390bd1 | 2124 | |
ram54288 | 0:dbad57390bd1 | 2125 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2126 | TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2127 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2128 | } |
ram54288 | 0:dbad57390bd1 | 2129 | |
ram54288 | 0:dbad57390bd1 | 2130 | void testEqualMemoryArrays(void) |
ram54288 | 0:dbad57390bd1 | 2131 | { |
ram54288 | 0:dbad57390bd1 | 2132 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2133 | int p1[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2134 | int p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2135 | int p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 2136 | |
ram54288 | 0:dbad57390bd1 | 2137 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, sizeof(int), 1); |
ram54288 | 0:dbad57390bd1 | 2138 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2139 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2140 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, sizeof(int), 3); |
ram54288 | 0:dbad57390bd1 | 2141 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, sizeof(int), 1); |
ram54288 | 0:dbad57390bd1 | 2142 | } |
ram54288 | 0:dbad57390bd1 | 2143 | |
ram54288 | 0:dbad57390bd1 | 2144 | void testNotEqualMemoryArraysExpectedNull(void) |
ram54288 | 0:dbad57390bd1 | 2145 | { |
ram54288 | 0:dbad57390bd1 | 2146 | int* p0 = NULL; |
ram54288 | 0:dbad57390bd1 | 2147 | int p1[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2148 | |
ram54288 | 0:dbad57390bd1 | 2149 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2150 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2151 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2152 | } |
ram54288 | 0:dbad57390bd1 | 2153 | |
ram54288 | 0:dbad57390bd1 | 2154 | void testNotEqualMemoryArraysActualNull(void) |
ram54288 | 0:dbad57390bd1 | 2155 | { |
ram54288 | 0:dbad57390bd1 | 2156 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2157 | int* p1 = NULL; |
ram54288 | 0:dbad57390bd1 | 2158 | |
ram54288 | 0:dbad57390bd1 | 2159 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2160 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2161 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2162 | } |
ram54288 | 0:dbad57390bd1 | 2163 | |
ram54288 | 0:dbad57390bd1 | 2164 | void testNotEqualMemoryArrays1(void) |
ram54288 | 0:dbad57390bd1 | 2165 | { |
ram54288 | 0:dbad57390bd1 | 2166 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2167 | int p1[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2168 | |
ram54288 | 0:dbad57390bd1 | 2169 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2170 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2171 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2172 | } |
ram54288 | 0:dbad57390bd1 | 2173 | |
ram54288 | 0:dbad57390bd1 | 2174 | void testNotEqualMemoryArrays2(void) |
ram54288 | 0:dbad57390bd1 | 2175 | { |
ram54288 | 0:dbad57390bd1 | 2176 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2177 | int p1[] = {2, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2178 | |
ram54288 | 0:dbad57390bd1 | 2179 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2180 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2181 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2182 | } |
ram54288 | 0:dbad57390bd1 | 2183 | |
ram54288 | 0:dbad57390bd1 | 2184 | void testNotEqualMemoryArrays3(void) |
ram54288 | 0:dbad57390bd1 | 2185 | { |
ram54288 | 0:dbad57390bd1 | 2186 | int p0[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2187 | int p1[] = {1, 8, 986, -2}; |
ram54288 | 0:dbad57390bd1 | 2188 | |
ram54288 | 0:dbad57390bd1 | 2189 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2190 | TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); |
ram54288 | 0:dbad57390bd1 | 2191 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2192 | } |
ram54288 | 0:dbad57390bd1 | 2193 | |
ram54288 | 0:dbad57390bd1 | 2194 | void testProtection(void) |
ram54288 | 0:dbad57390bd1 | 2195 | { |
ram54288 | 0:dbad57390bd1 | 2196 | volatile int mask = 0; |
ram54288 | 0:dbad57390bd1 | 2197 | |
ram54288 | 0:dbad57390bd1 | 2198 | if (TEST_PROTECT()) |
ram54288 | 0:dbad57390bd1 | 2199 | { |
ram54288 | 0:dbad57390bd1 | 2200 | mask |= 1; |
ram54288 | 0:dbad57390bd1 | 2201 | TEST_ABORT(); |
ram54288 | 0:dbad57390bd1 | 2202 | } |
ram54288 | 0:dbad57390bd1 | 2203 | else |
ram54288 | 0:dbad57390bd1 | 2204 | { |
ram54288 | 0:dbad57390bd1 | 2205 | Unity.CurrentTestFailed = 0; |
ram54288 | 0:dbad57390bd1 | 2206 | mask |= 2; |
ram54288 | 0:dbad57390bd1 | 2207 | } |
ram54288 | 0:dbad57390bd1 | 2208 | |
ram54288 | 0:dbad57390bd1 | 2209 | TEST_ASSERT_EQUAL(3, mask); |
ram54288 | 0:dbad57390bd1 | 2210 | } |
ram54288 | 0:dbad57390bd1 | 2211 | |
ram54288 | 0:dbad57390bd1 | 2212 | void testIgnoredAndThenFailInTearDown(void) |
ram54288 | 0:dbad57390bd1 | 2213 | { |
ram54288 | 0:dbad57390bd1 | 2214 | SetToOneToFailInTearDown = 1; |
ram54288 | 0:dbad57390bd1 | 2215 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2216 | } |
ram54288 | 0:dbad57390bd1 | 2217 | |
ram54288 | 0:dbad57390bd1 | 2218 | // Tricky series of macros to set USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2219 | #define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0) |
ram54288 | 0:dbad57390bd1 | 2220 | #define ASSIGN_VALUE(a) VAL_##a |
ram54288 | 0:dbad57390bd1 | 2221 | #define VAL_putcharSpy 0, 1 |
ram54288 | 0:dbad57390bd1 | 2222 | #define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b, throwaway) |
ram54288 | 0:dbad57390bd1 | 2223 | #define SECOND_PARAM(a, b, ...) b |
ram54288 | 0:dbad57390bd1 | 2224 | #if USING_SPY_AS(UNITY_OUTPUT_CHAR) |
ram54288 | 0:dbad57390bd1 | 2225 | #define USING_OUTPUT_SPY // true only if UNITY_OUTPUT_CHAR = putcharSpy |
ram54288 | 0:dbad57390bd1 | 2226 | #endif |
ram54288 | 0:dbad57390bd1 | 2227 | |
ram54288 | 0:dbad57390bd1 | 2228 | #ifdef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2229 | #include <stdio.h> |
ram54288 | 0:dbad57390bd1 | 2230 | #define SPY_BUFFER_MAX 40 |
ram54288 | 0:dbad57390bd1 | 2231 | static char putcharSpyBuffer[SPY_BUFFER_MAX]; |
ram54288 | 0:dbad57390bd1 | 2232 | #endif |
ram54288 | 0:dbad57390bd1 | 2233 | static int indexSpyBuffer; |
ram54288 | 0:dbad57390bd1 | 2234 | static int putcharSpyEnabled; |
ram54288 | 0:dbad57390bd1 | 2235 | |
ram54288 | 0:dbad57390bd1 | 2236 | void startPutcharSpy(void) {indexSpyBuffer = 0; putcharSpyEnabled = 1;} |
ram54288 | 0:dbad57390bd1 | 2237 | |
ram54288 | 0:dbad57390bd1 | 2238 | void endPutcharSpy(void) {putcharSpyEnabled = 0;} |
ram54288 | 0:dbad57390bd1 | 2239 | |
ram54288 | 0:dbad57390bd1 | 2240 | char* getBufferPutcharSpy(void) |
ram54288 | 0:dbad57390bd1 | 2241 | { |
ram54288 | 0:dbad57390bd1 | 2242 | #ifdef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2243 | putcharSpyBuffer[indexSpyBuffer] = '\0'; |
ram54288 | 0:dbad57390bd1 | 2244 | return putcharSpyBuffer; |
ram54288 | 0:dbad57390bd1 | 2245 | #else |
ram54288 | 0:dbad57390bd1 | 2246 | return NULL; |
ram54288 | 0:dbad57390bd1 | 2247 | #endif |
ram54288 | 0:dbad57390bd1 | 2248 | } |
ram54288 | 0:dbad57390bd1 | 2249 | |
ram54288 | 0:dbad57390bd1 | 2250 | void putcharSpy(int c) |
ram54288 | 0:dbad57390bd1 | 2251 | { |
ram54288 | 0:dbad57390bd1 | 2252 | #ifdef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2253 | if (putcharSpyEnabled) |
ram54288 | 0:dbad57390bd1 | 2254 | { |
ram54288 | 0:dbad57390bd1 | 2255 | if (indexSpyBuffer < SPY_BUFFER_MAX - 1) |
ram54288 | 0:dbad57390bd1 | 2256 | putcharSpyBuffer[indexSpyBuffer++] = (char)c; |
ram54288 | 0:dbad57390bd1 | 2257 | } else |
ram54288 | 0:dbad57390bd1 | 2258 | c = putchar(c); |
ram54288 | 0:dbad57390bd1 | 2259 | #endif |
ram54288 | 0:dbad57390bd1 | 2260 | } |
ram54288 | 0:dbad57390bd1 | 2261 | |
ram54288 | 0:dbad57390bd1 | 2262 | void testFailureCountIncrementsAndIsReturnedAtEnd(void) |
ram54288 | 0:dbad57390bd1 | 2263 | { |
ram54288 | 0:dbad57390bd1 | 2264 | Unity.CurrentTestFailed = 1; |
ram54288 | 0:dbad57390bd1 | 2265 | startPutcharSpy(); // Suppress output |
ram54288 | 0:dbad57390bd1 | 2266 | UnityConcludeTest(); |
ram54288 | 0:dbad57390bd1 | 2267 | TEST_ASSERT_EQUAL(1, Unity.TestFailures); |
ram54288 | 0:dbad57390bd1 | 2268 | |
ram54288 | 0:dbad57390bd1 | 2269 | int failures = UnityEnd(); |
ram54288 | 0:dbad57390bd1 | 2270 | Unity.TestFailures--; |
ram54288 | 0:dbad57390bd1 | 2271 | endPutcharSpy(); |
ram54288 | 0:dbad57390bd1 | 2272 | TEST_ASSERT_EQUAL(1, failures); |
ram54288 | 0:dbad57390bd1 | 2273 | } |
ram54288 | 0:dbad57390bd1 | 2274 | |
ram54288 | 0:dbad57390bd1 | 2275 | #define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \ |
ram54288 | 0:dbad57390bd1 | 2276 | startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \ |
ram54288 | 0:dbad57390bd1 | 2277 | TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ |
ram54288 | 0:dbad57390bd1 | 2278 | } |
ram54288 | 0:dbad57390bd1 | 2279 | |
ram54288 | 0:dbad57390bd1 | 2280 | #define TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS(expected, actual) { \ |
ram54288 | 0:dbad57390bd1 | 2281 | startPutcharSpy(); UnityPrintNumberUnsigned((actual)); endPutcharSpy(); \ |
ram54288 | 0:dbad57390bd1 | 2282 | TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ |
ram54288 | 0:dbad57390bd1 | 2283 | } |
ram54288 | 0:dbad57390bd1 | 2284 | |
ram54288 | 0:dbad57390bd1 | 2285 | void testPrintNumbers32(void) |
ram54288 | 0:dbad57390bd1 | 2286 | { |
ram54288 | 0:dbad57390bd1 | 2287 | #ifndef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2288 | TEST_IGNORE_MESSAGE("Compile with '-D UNITY_OUTPUT_CHAR=putcharSpy' to enable print testing"); |
ram54288 | 0:dbad57390bd1 | 2289 | #else |
ram54288 | 0:dbad57390bd1 | 2290 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("0", 0); |
ram54288 | 0:dbad57390bd1 | 2291 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("1", 1); |
ram54288 | 0:dbad57390bd1 | 2292 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", -1); |
ram54288 | 0:dbad57390bd1 | 2293 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("2000000000", 2000000000); |
ram54288 | 0:dbad57390bd1 | 2294 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("-2147483648", (_US32)0x80000000); |
ram54288 | 0:dbad57390bd1 | 2295 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", (_US32)0xFFFFFFFF); |
ram54288 | 0:dbad57390bd1 | 2296 | #endif |
ram54288 | 0:dbad57390bd1 | 2297 | } |
ram54288 | 0:dbad57390bd1 | 2298 | |
ram54288 | 0:dbad57390bd1 | 2299 | void testPrintNumbersUnsigned32(void) |
ram54288 | 0:dbad57390bd1 | 2300 | { |
ram54288 | 0:dbad57390bd1 | 2301 | #ifndef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2302 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2303 | #else |
ram54288 | 0:dbad57390bd1 | 2304 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("0", 0); |
ram54288 | 0:dbad57390bd1 | 2305 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("1", 1); |
ram54288 | 0:dbad57390bd1 | 2306 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("1500000000", 1500000000); |
ram54288 | 0:dbad57390bd1 | 2307 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("2147483648", (_UU32)0x80000000); |
ram54288 | 0:dbad57390bd1 | 2308 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("4294967295", (_UU32)0xFFFFFFFF); |
ram54288 | 0:dbad57390bd1 | 2309 | #endif |
ram54288 | 0:dbad57390bd1 | 2310 | } |
ram54288 | 0:dbad57390bd1 | 2311 | |
ram54288 | 0:dbad57390bd1 | 2312 | // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== |
ram54288 | 0:dbad57390bd1 | 2313 | |
ram54288 | 0:dbad57390bd1 | 2314 | void testPrintNumbersInt64(void) |
ram54288 | 0:dbad57390bd1 | 2315 | { |
ram54288 | 0:dbad57390bd1 | 2316 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2317 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2318 | #else |
ram54288 | 0:dbad57390bd1 | 2319 | #ifndef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2320 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2321 | #else |
ram54288 | 0:dbad57390bd1 | 2322 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("0", 0); |
ram54288 | 0:dbad57390bd1 | 2323 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("10000000000", 10000000000); |
ram54288 | 0:dbad57390bd1 | 2324 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("-9223372036854775808", (_U_SINT)0x8000000000000000); |
ram54288 | 0:dbad57390bd1 | 2325 | TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", (_U_SINT)0xFFFFFFFFFFFFFFFF); |
ram54288 | 0:dbad57390bd1 | 2326 | #endif |
ram54288 | 0:dbad57390bd1 | 2327 | #endif |
ram54288 | 0:dbad57390bd1 | 2328 | } |
ram54288 | 0:dbad57390bd1 | 2329 | |
ram54288 | 0:dbad57390bd1 | 2330 | void testPrintNumbersUInt64(void) |
ram54288 | 0:dbad57390bd1 | 2331 | { |
ram54288 | 0:dbad57390bd1 | 2332 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2333 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2334 | #else |
ram54288 | 0:dbad57390bd1 | 2335 | #ifndef USING_OUTPUT_SPY |
ram54288 | 0:dbad57390bd1 | 2336 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2337 | #else |
ram54288 | 0:dbad57390bd1 | 2338 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("0", 0); |
ram54288 | 0:dbad57390bd1 | 2339 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("70000000000", 70000000000); |
ram54288 | 0:dbad57390bd1 | 2340 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("9223372036854775808", (_U_UINT)0x8000000000000000); |
ram54288 | 0:dbad57390bd1 | 2341 | TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("18446744073709551615", (_U_UINT)0xFFFFFFFFFFFFFFFF); |
ram54288 | 0:dbad57390bd1 | 2342 | #endif |
ram54288 | 0:dbad57390bd1 | 2343 | #endif |
ram54288 | 0:dbad57390bd1 | 2344 | } |
ram54288 | 0:dbad57390bd1 | 2345 | |
ram54288 | 0:dbad57390bd1 | 2346 | void testEqualHex64s(void) |
ram54288 | 0:dbad57390bd1 | 2347 | { |
ram54288 | 0:dbad57390bd1 | 2348 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2349 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2350 | #else |
ram54288 | 0:dbad57390bd1 | 2351 | _UU64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2352 | _UU64 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 2353 | |
ram54288 | 0:dbad57390bd1 | 2354 | v0 = 0x9876543201234567; |
ram54288 | 0:dbad57390bd1 | 2355 | v1 = 0x9876543201234567; |
ram54288 | 0:dbad57390bd1 | 2356 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 2357 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 2358 | |
ram54288 | 0:dbad57390bd1 | 2359 | TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2360 | TEST_ASSERT_EQUAL_HEX64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2361 | TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); |
ram54288 | 0:dbad57390bd1 | 2362 | TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2363 | TEST_ASSERT_EQUAL_HEX64(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 2364 | TEST_ASSERT_EQUAL_HEX64(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 2365 | TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2366 | #endif |
ram54288 | 0:dbad57390bd1 | 2367 | } |
ram54288 | 0:dbad57390bd1 | 2368 | |
ram54288 | 0:dbad57390bd1 | 2369 | void testEqualUint64s(void) |
ram54288 | 0:dbad57390bd1 | 2370 | { |
ram54288 | 0:dbad57390bd1 | 2371 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2372 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2373 | #else |
ram54288 | 0:dbad57390bd1 | 2374 | _UU64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2375 | _UU64 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 2376 | |
ram54288 | 0:dbad57390bd1 | 2377 | v0 = 0x9876543201234567; |
ram54288 | 0:dbad57390bd1 | 2378 | v1 = 0x9876543201234567; |
ram54288 | 0:dbad57390bd1 | 2379 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 2380 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 2381 | |
ram54288 | 0:dbad57390bd1 | 2382 | TEST_ASSERT_EQUAL_UINT64(0x9876543201234567, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2383 | TEST_ASSERT_EQUAL_UINT64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2384 | TEST_ASSERT_EQUAL_UINT64(0x9876543201234567, v1); |
ram54288 | 0:dbad57390bd1 | 2385 | TEST_ASSERT_EQUAL_UINT64(v0, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2386 | TEST_ASSERT_EQUAL_UINT64(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 2387 | TEST_ASSERT_EQUAL_UINT64(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 2388 | TEST_ASSERT_EQUAL_UINT64(*p0, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2389 | #endif |
ram54288 | 0:dbad57390bd1 | 2390 | } |
ram54288 | 0:dbad57390bd1 | 2391 | |
ram54288 | 0:dbad57390bd1 | 2392 | void testEqualInt64s(void) |
ram54288 | 0:dbad57390bd1 | 2393 | { |
ram54288 | 0:dbad57390bd1 | 2394 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2395 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2396 | #else |
ram54288 | 0:dbad57390bd1 | 2397 | _US64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2398 | _US64 *p0, *p1; |
ram54288 | 0:dbad57390bd1 | 2399 | |
ram54288 | 0:dbad57390bd1 | 2400 | v0 = (_US64)0x9876543201234567; |
ram54288 | 0:dbad57390bd1 | 2401 | v1 = (_US64)0x9876543201234567; |
ram54288 | 0:dbad57390bd1 | 2402 | p0 = &v0; |
ram54288 | 0:dbad57390bd1 | 2403 | p1 = &v1; |
ram54288 | 0:dbad57390bd1 | 2404 | |
ram54288 | 0:dbad57390bd1 | 2405 | TEST_ASSERT_EQUAL_INT64(0x9876543201234567, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2406 | TEST_ASSERT_EQUAL_INT64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2407 | TEST_ASSERT_EQUAL_INT64(0x9876543201234567, v1); |
ram54288 | 0:dbad57390bd1 | 2408 | TEST_ASSERT_EQUAL_INT64(v0, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2409 | TEST_ASSERT_EQUAL_INT64(*p0, v1); |
ram54288 | 0:dbad57390bd1 | 2410 | TEST_ASSERT_EQUAL_INT64(*p0, *p1); |
ram54288 | 0:dbad57390bd1 | 2411 | TEST_ASSERT_EQUAL_INT64(*p0, 0x9876543201234567); |
ram54288 | 0:dbad57390bd1 | 2412 | #endif |
ram54288 | 0:dbad57390bd1 | 2413 | } |
ram54288 | 0:dbad57390bd1 | 2414 | |
ram54288 | 0:dbad57390bd1 | 2415 | |
ram54288 | 0:dbad57390bd1 | 2416 | void testNotEqualHex64s(void) |
ram54288 | 0:dbad57390bd1 | 2417 | { |
ram54288 | 0:dbad57390bd1 | 2418 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2419 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2420 | #else |
ram54288 | 0:dbad57390bd1 | 2421 | _UU64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2422 | |
ram54288 | 0:dbad57390bd1 | 2423 | v0 = 9000000000; |
ram54288 | 0:dbad57390bd1 | 2424 | v1 = 9100000000; |
ram54288 | 0:dbad57390bd1 | 2425 | |
ram54288 | 0:dbad57390bd1 | 2426 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2427 | TEST_ASSERT_EQUAL_HEX64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2428 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2429 | #endif |
ram54288 | 0:dbad57390bd1 | 2430 | } |
ram54288 | 0:dbad57390bd1 | 2431 | |
ram54288 | 0:dbad57390bd1 | 2432 | void testNotEqualUint64s(void) |
ram54288 | 0:dbad57390bd1 | 2433 | { |
ram54288 | 0:dbad57390bd1 | 2434 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2435 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2436 | #else |
ram54288 | 0:dbad57390bd1 | 2437 | _UU64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2438 | |
ram54288 | 0:dbad57390bd1 | 2439 | v0 = 9000000000; |
ram54288 | 0:dbad57390bd1 | 2440 | v1 = 9100000000; |
ram54288 | 0:dbad57390bd1 | 2441 | |
ram54288 | 0:dbad57390bd1 | 2442 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2443 | TEST_ASSERT_EQUAL_UINT64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2444 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2445 | #endif |
ram54288 | 0:dbad57390bd1 | 2446 | } |
ram54288 | 0:dbad57390bd1 | 2447 | |
ram54288 | 0:dbad57390bd1 | 2448 | void testNotEqualInt64s(void) |
ram54288 | 0:dbad57390bd1 | 2449 | { |
ram54288 | 0:dbad57390bd1 | 2450 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2451 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2452 | #else |
ram54288 | 0:dbad57390bd1 | 2453 | _US64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2454 | |
ram54288 | 0:dbad57390bd1 | 2455 | v0 = -9000000000; |
ram54288 | 0:dbad57390bd1 | 2456 | v1 = 9100000000; |
ram54288 | 0:dbad57390bd1 | 2457 | |
ram54288 | 0:dbad57390bd1 | 2458 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2459 | TEST_ASSERT_EQUAL_INT64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2460 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2461 | #endif |
ram54288 | 0:dbad57390bd1 | 2462 | } |
ram54288 | 0:dbad57390bd1 | 2463 | |
ram54288 | 0:dbad57390bd1 | 2464 | void testNotEqualHex64sIfSigned(void) |
ram54288 | 0:dbad57390bd1 | 2465 | { |
ram54288 | 0:dbad57390bd1 | 2466 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2467 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2468 | #else |
ram54288 | 0:dbad57390bd1 | 2469 | _US64 v0, v1; |
ram54288 | 0:dbad57390bd1 | 2470 | |
ram54288 | 0:dbad57390bd1 | 2471 | v0 = -9000000000; |
ram54288 | 0:dbad57390bd1 | 2472 | v1 = 9000000000; |
ram54288 | 0:dbad57390bd1 | 2473 | |
ram54288 | 0:dbad57390bd1 | 2474 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2475 | TEST_ASSERT_EQUAL_HEX64(v0, v1); |
ram54288 | 0:dbad57390bd1 | 2476 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2477 | #endif |
ram54288 | 0:dbad57390bd1 | 2478 | } |
ram54288 | 0:dbad57390bd1 | 2479 | |
ram54288 | 0:dbad57390bd1 | 2480 | void testHEX64sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2481 | { |
ram54288 | 0:dbad57390bd1 | 2482 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2483 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2484 | #else |
ram54288 | 0:dbad57390bd1 | 2485 | TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); |
ram54288 | 0:dbad57390bd1 | 2486 | TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 2487 | TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 2488 | #endif |
ram54288 | 0:dbad57390bd1 | 2489 | } |
ram54288 | 0:dbad57390bd1 | 2490 | |
ram54288 | 0:dbad57390bd1 | 2491 | void testHEX64sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2492 | { |
ram54288 | 0:dbad57390bd1 | 2493 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2494 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2495 | #else |
ram54288 | 0:dbad57390bd1 | 2496 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2497 | TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); |
ram54288 | 0:dbad57390bd1 | 2498 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2499 | #endif |
ram54288 | 0:dbad57390bd1 | 2500 | } |
ram54288 | 0:dbad57390bd1 | 2501 | |
ram54288 | 0:dbad57390bd1 | 2502 | void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) |
ram54288 | 0:dbad57390bd1 | 2503 | { |
ram54288 | 0:dbad57390bd1 | 2504 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2505 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2506 | #else |
ram54288 | 0:dbad57390bd1 | 2507 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2508 | TEST_ASSERT_HEX64_WITHIN(5, 1, -1); |
ram54288 | 0:dbad57390bd1 | 2509 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2510 | #endif |
ram54288 | 0:dbad57390bd1 | 2511 | } |
ram54288 | 0:dbad57390bd1 | 2512 | |
ram54288 | 0:dbad57390bd1 | 2513 | void testUINT64sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2514 | { |
ram54288 | 0:dbad57390bd1 | 2515 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2516 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2517 | #else |
ram54288 | 0:dbad57390bd1 | 2518 | TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); |
ram54288 | 0:dbad57390bd1 | 2519 | TEST_ASSERT_UINT64_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 2520 | TEST_ASSERT_UINT64_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 2521 | #endif |
ram54288 | 0:dbad57390bd1 | 2522 | } |
ram54288 | 0:dbad57390bd1 | 2523 | |
ram54288 | 0:dbad57390bd1 | 2524 | void testUINT64sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2525 | { |
ram54288 | 0:dbad57390bd1 | 2526 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2527 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2528 | #else |
ram54288 | 0:dbad57390bd1 | 2529 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2530 | TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); |
ram54288 | 0:dbad57390bd1 | 2531 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2532 | #endif |
ram54288 | 0:dbad57390bd1 | 2533 | } |
ram54288 | 0:dbad57390bd1 | 2534 | |
ram54288 | 0:dbad57390bd1 | 2535 | void testUINT64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) |
ram54288 | 0:dbad57390bd1 | 2536 | { |
ram54288 | 0:dbad57390bd1 | 2537 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2538 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2539 | #else |
ram54288 | 0:dbad57390bd1 | 2540 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2541 | TEST_ASSERT_UINT64_WITHIN(5, 1, -1); |
ram54288 | 0:dbad57390bd1 | 2542 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2543 | #endif |
ram54288 | 0:dbad57390bd1 | 2544 | } |
ram54288 | 0:dbad57390bd1 | 2545 | |
ram54288 | 0:dbad57390bd1 | 2546 | void testINT64sWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2547 | { |
ram54288 | 0:dbad57390bd1 | 2548 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2549 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2550 | #else |
ram54288 | 0:dbad57390bd1 | 2551 | TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); |
ram54288 | 0:dbad57390bd1 | 2552 | TEST_ASSERT_INT64_WITHIN(5, 5000, 4996); |
ram54288 | 0:dbad57390bd1 | 2553 | TEST_ASSERT_INT64_WITHIN(5, 5000, 5005); |
ram54288 | 0:dbad57390bd1 | 2554 | #endif |
ram54288 | 0:dbad57390bd1 | 2555 | } |
ram54288 | 0:dbad57390bd1 | 2556 | |
ram54288 | 0:dbad57390bd1 | 2557 | void testINT64sNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2558 | { |
ram54288 | 0:dbad57390bd1 | 2559 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2560 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2561 | #else |
ram54288 | 0:dbad57390bd1 | 2562 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2563 | TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); |
ram54288 | 0:dbad57390bd1 | 2564 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2565 | #endif |
ram54288 | 0:dbad57390bd1 | 2566 | } |
ram54288 | 0:dbad57390bd1 | 2567 | |
ram54288 | 0:dbad57390bd1 | 2568 | void testINT64sNotWithinDeltaAndDifferenceOverflows(void) |
ram54288 | 0:dbad57390bd1 | 2569 | { |
ram54288 | 0:dbad57390bd1 | 2570 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2571 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2572 | #else |
ram54288 | 0:dbad57390bd1 | 2573 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2574 | TEST_ASSERT_INT64_WITHIN(1, 0x8000000000000000, 0x7FFFFFFFFFFFFFFF); |
ram54288 | 0:dbad57390bd1 | 2575 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2576 | #endif |
ram54288 | 0:dbad57390bd1 | 2577 | } |
ram54288 | 0:dbad57390bd1 | 2578 | |
ram54288 | 0:dbad57390bd1 | 2579 | void testEqualHEX64Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2580 | { |
ram54288 | 0:dbad57390bd1 | 2581 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2582 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2583 | #else |
ram54288 | 0:dbad57390bd1 | 2584 | _UU64 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2585 | _UU64 p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2586 | _UU64 p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2587 | _UU64 p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 2588 | |
ram54288 | 0:dbad57390bd1 | 2589 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 2590 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 2591 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2592 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 2593 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 2594 | #endif |
ram54288 | 0:dbad57390bd1 | 2595 | } |
ram54288 | 0:dbad57390bd1 | 2596 | |
ram54288 | 0:dbad57390bd1 | 2597 | void testEqualUint64Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2598 | { |
ram54288 | 0:dbad57390bd1 | 2599 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2600 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2601 | #else |
ram54288 | 0:dbad57390bd1 | 2602 | _UU64 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2603 | _UU64 p1[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2604 | _UU64 p2[] = {1, 8, 987, 2}; |
ram54288 | 0:dbad57390bd1 | 2605 | _UU64 p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 2606 | |
ram54288 | 0:dbad57390bd1 | 2607 | TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 2608 | TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 2609 | TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2610 | TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 2611 | TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 2612 | #endif |
ram54288 | 0:dbad57390bd1 | 2613 | } |
ram54288 | 0:dbad57390bd1 | 2614 | |
ram54288 | 0:dbad57390bd1 | 2615 | void testEqualInt64Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2616 | { |
ram54288 | 0:dbad57390bd1 | 2617 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2618 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2619 | #else |
ram54288 | 0:dbad57390bd1 | 2620 | _US64 p0[] = {1, 8, 987, -65132}; |
ram54288 | 0:dbad57390bd1 | 2621 | _US64 p1[] = {1, 8, 987, -65132}; |
ram54288 | 0:dbad57390bd1 | 2622 | _US64 p2[] = {1, 8, 987, -2}; |
ram54288 | 0:dbad57390bd1 | 2623 | _US64 p3[] = {1, 500, 600, 700}; |
ram54288 | 0:dbad57390bd1 | 2624 | |
ram54288 | 0:dbad57390bd1 | 2625 | TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 2626 | TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 2627 | TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2628 | TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 2629 | TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 2630 | #endif |
ram54288 | 0:dbad57390bd1 | 2631 | } |
ram54288 | 0:dbad57390bd1 | 2632 | |
ram54288 | 0:dbad57390bd1 | 2633 | |
ram54288 | 0:dbad57390bd1 | 2634 | void testNotEqualHEX64Arrays1(void) |
ram54288 | 0:dbad57390bd1 | 2635 | { |
ram54288 | 0:dbad57390bd1 | 2636 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2637 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2638 | #else |
ram54288 | 0:dbad57390bd1 | 2639 | _UU64 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2640 | _UU64 p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 2641 | |
ram54288 | 0:dbad57390bd1 | 2642 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2643 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2644 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2645 | #endif |
ram54288 | 0:dbad57390bd1 | 2646 | } |
ram54288 | 0:dbad57390bd1 | 2647 | |
ram54288 | 0:dbad57390bd1 | 2648 | void testNotEqualHEX64Arrays2(void) |
ram54288 | 0:dbad57390bd1 | 2649 | { |
ram54288 | 0:dbad57390bd1 | 2650 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2651 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2652 | #else |
ram54288 | 0:dbad57390bd1 | 2653 | _UU64 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2654 | _UU64 p1[] = {2, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2655 | |
ram54288 | 0:dbad57390bd1 | 2656 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2657 | TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2658 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2659 | #endif |
ram54288 | 0:dbad57390bd1 | 2660 | } |
ram54288 | 0:dbad57390bd1 | 2661 | |
ram54288 | 0:dbad57390bd1 | 2662 | void testNotEqualUint64Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2663 | { |
ram54288 | 0:dbad57390bd1 | 2664 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2665 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2666 | #else |
ram54288 | 0:dbad57390bd1 | 2667 | _UU64 p0[] = {1, 8, 987, 65132u}; |
ram54288 | 0:dbad57390bd1 | 2668 | _UU64 p1[] = {1, 8, 987, 65131u}; |
ram54288 | 0:dbad57390bd1 | 2669 | |
ram54288 | 0:dbad57390bd1 | 2670 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2671 | TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2672 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2673 | #endif |
ram54288 | 0:dbad57390bd1 | 2674 | } |
ram54288 | 0:dbad57390bd1 | 2675 | |
ram54288 | 0:dbad57390bd1 | 2676 | void testNotEqualInt64Arrays(void) |
ram54288 | 0:dbad57390bd1 | 2677 | { |
ram54288 | 0:dbad57390bd1 | 2678 | #ifndef UNITY_SUPPORT_64 |
ram54288 | 0:dbad57390bd1 | 2679 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2680 | #else |
ram54288 | 0:dbad57390bd1 | 2681 | _US64 p0[] = {1, 8, 987, -65132}; |
ram54288 | 0:dbad57390bd1 | 2682 | _US64 p1[] = {1, 8, 987, -65131}; |
ram54288 | 0:dbad57390bd1 | 2683 | |
ram54288 | 0:dbad57390bd1 | 2684 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2685 | TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 2686 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2687 | #endif |
ram54288 | 0:dbad57390bd1 | 2688 | } |
ram54288 | 0:dbad57390bd1 | 2689 | // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== |
ram54288 | 0:dbad57390bd1 | 2690 | |
ram54288 | 0:dbad57390bd1 | 2691 | void testFloatsWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2692 | { |
ram54288 | 0:dbad57390bd1 | 2693 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2694 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2695 | #else |
ram54288 | 0:dbad57390bd1 | 2696 | TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); |
ram54288 | 0:dbad57390bd1 | 2697 | TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); |
ram54288 | 0:dbad57390bd1 | 2698 | TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); |
ram54288 | 0:dbad57390bd1 | 2699 | TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); |
ram54288 | 0:dbad57390bd1 | 2700 | #endif |
ram54288 | 0:dbad57390bd1 | 2701 | } |
ram54288 | 0:dbad57390bd1 | 2702 | |
ram54288 | 0:dbad57390bd1 | 2703 | void testFloatsNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 2704 | { |
ram54288 | 0:dbad57390bd1 | 2705 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2706 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2707 | #else |
ram54288 | 0:dbad57390bd1 | 2708 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2709 | TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); |
ram54288 | 0:dbad57390bd1 | 2710 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2711 | #endif |
ram54288 | 0:dbad57390bd1 | 2712 | } |
ram54288 | 0:dbad57390bd1 | 2713 | |
ram54288 | 0:dbad57390bd1 | 2714 | void testFloatsEqual(void) |
ram54288 | 0:dbad57390bd1 | 2715 | { |
ram54288 | 0:dbad57390bd1 | 2716 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2717 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2718 | #else |
ram54288 | 0:dbad57390bd1 | 2719 | TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); |
ram54288 | 0:dbad57390bd1 | 2720 | TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); |
ram54288 | 0:dbad57390bd1 | 2721 | TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); |
ram54288 | 0:dbad57390bd1 | 2722 | TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); |
ram54288 | 0:dbad57390bd1 | 2723 | #endif |
ram54288 | 0:dbad57390bd1 | 2724 | } |
ram54288 | 0:dbad57390bd1 | 2725 | |
ram54288 | 0:dbad57390bd1 | 2726 | void testFloatsNotEqual(void) |
ram54288 | 0:dbad57390bd1 | 2727 | { |
ram54288 | 0:dbad57390bd1 | 2728 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2729 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2730 | #else |
ram54288 | 0:dbad57390bd1 | 2731 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2732 | TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); |
ram54288 | 0:dbad57390bd1 | 2733 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2734 | #endif |
ram54288 | 0:dbad57390bd1 | 2735 | } |
ram54288 | 0:dbad57390bd1 | 2736 | |
ram54288 | 0:dbad57390bd1 | 2737 | void testFloatsNotEqualNegative1(void) |
ram54288 | 0:dbad57390bd1 | 2738 | { |
ram54288 | 0:dbad57390bd1 | 2739 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2740 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2741 | #else |
ram54288 | 0:dbad57390bd1 | 2742 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2743 | TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); |
ram54288 | 0:dbad57390bd1 | 2744 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2745 | #endif |
ram54288 | 0:dbad57390bd1 | 2746 | } |
ram54288 | 0:dbad57390bd1 | 2747 | |
ram54288 | 0:dbad57390bd1 | 2748 | void testFloatsNotEqualNegative2(void) |
ram54288 | 0:dbad57390bd1 | 2749 | { |
ram54288 | 0:dbad57390bd1 | 2750 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2751 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2752 | #else |
ram54288 | 0:dbad57390bd1 | 2753 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2754 | TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); |
ram54288 | 0:dbad57390bd1 | 2755 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2756 | #endif |
ram54288 | 0:dbad57390bd1 | 2757 | } |
ram54288 | 0:dbad57390bd1 | 2758 | |
ram54288 | 0:dbad57390bd1 | 2759 | void testFloatsNotEqualActualNaN(void) |
ram54288 | 0:dbad57390bd1 | 2760 | { |
ram54288 | 0:dbad57390bd1 | 2761 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2762 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2763 | #else |
ram54288 | 0:dbad57390bd1 | 2764 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2765 | TEST_ASSERT_EQUAL_FLOAT(85.963f, 0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2766 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2767 | #endif |
ram54288 | 0:dbad57390bd1 | 2768 | } |
ram54288 | 0:dbad57390bd1 | 2769 | |
ram54288 | 0:dbad57390bd1 | 2770 | void testFloatsNotEqualExpectedNaN(void) |
ram54288 | 0:dbad57390bd1 | 2771 | { |
ram54288 | 0:dbad57390bd1 | 2772 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2773 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2774 | #else |
ram54288 | 0:dbad57390bd1 | 2775 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2776 | TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 85.963f); |
ram54288 | 0:dbad57390bd1 | 2777 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2778 | #endif |
ram54288 | 0:dbad57390bd1 | 2779 | } |
ram54288 | 0:dbad57390bd1 | 2780 | |
ram54288 | 0:dbad57390bd1 | 2781 | void testFloatsNotEqualBothNaN(void) |
ram54288 | 0:dbad57390bd1 | 2782 | { |
ram54288 | 0:dbad57390bd1 | 2783 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2784 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2785 | #else |
ram54288 | 0:dbad57390bd1 | 2786 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2787 | TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2788 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2789 | #endif |
ram54288 | 0:dbad57390bd1 | 2790 | } |
ram54288 | 0:dbad57390bd1 | 2791 | |
ram54288 | 0:dbad57390bd1 | 2792 | void testFloatsNotEqualInfNaN(void) |
ram54288 | 0:dbad57390bd1 | 2793 | { |
ram54288 | 0:dbad57390bd1 | 2794 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2795 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2796 | #else |
ram54288 | 0:dbad57390bd1 | 2797 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2798 | TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2799 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2800 | #endif |
ram54288 | 0:dbad57390bd1 | 2801 | } |
ram54288 | 0:dbad57390bd1 | 2802 | |
ram54288 | 0:dbad57390bd1 | 2803 | void testFloatsNotEqualNaNInf(void) |
ram54288 | 0:dbad57390bd1 | 2804 | { |
ram54288 | 0:dbad57390bd1 | 2805 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2806 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2807 | #else |
ram54288 | 0:dbad57390bd1 | 2808 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2809 | TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2810 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2811 | #endif |
ram54288 | 0:dbad57390bd1 | 2812 | } |
ram54288 | 0:dbad57390bd1 | 2813 | |
ram54288 | 0:dbad57390bd1 | 2814 | void testFloatsNotEqualActualInf(void) |
ram54288 | 0:dbad57390bd1 | 2815 | { |
ram54288 | 0:dbad57390bd1 | 2816 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2817 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2818 | #else |
ram54288 | 0:dbad57390bd1 | 2819 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2820 | TEST_ASSERT_EQUAL_FLOAT(321.642f, 1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2821 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2822 | #endif |
ram54288 | 0:dbad57390bd1 | 2823 | } |
ram54288 | 0:dbad57390bd1 | 2824 | |
ram54288 | 0:dbad57390bd1 | 2825 | void testFloatsNotEqualExpectedInf(void) |
ram54288 | 0:dbad57390bd1 | 2826 | { |
ram54288 | 0:dbad57390bd1 | 2827 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2828 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2829 | #else |
ram54288 | 0:dbad57390bd1 | 2830 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2831 | TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 321.642f); |
ram54288 | 0:dbad57390bd1 | 2832 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2833 | #endif |
ram54288 | 0:dbad57390bd1 | 2834 | } |
ram54288 | 0:dbad57390bd1 | 2835 | |
ram54288 | 0:dbad57390bd1 | 2836 | void testFloatsNotEqualBothInf(void) |
ram54288 | 0:dbad57390bd1 | 2837 | { |
ram54288 | 0:dbad57390bd1 | 2838 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2839 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2840 | #else |
ram54288 | 0:dbad57390bd1 | 2841 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2842 | TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2843 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2844 | #endif |
ram54288 | 0:dbad57390bd1 | 2845 | } |
ram54288 | 0:dbad57390bd1 | 2846 | |
ram54288 | 0:dbad57390bd1 | 2847 | void testFloatsNotEqualPlusMinusInf(void) |
ram54288 | 0:dbad57390bd1 | 2848 | { |
ram54288 | 0:dbad57390bd1 | 2849 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2850 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2851 | #else |
ram54288 | 0:dbad57390bd1 | 2852 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2853 | TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2854 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2855 | #endif |
ram54288 | 0:dbad57390bd1 | 2856 | } |
ram54288 | 0:dbad57390bd1 | 2857 | |
ram54288 | 0:dbad57390bd1 | 2858 | void testFloatIsPosInf1(void) |
ram54288 | 0:dbad57390bd1 | 2859 | { |
ram54288 | 0:dbad57390bd1 | 2860 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2861 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2862 | #else |
ram54288 | 0:dbad57390bd1 | 2863 | TEST_ASSERT_FLOAT_IS_INF(2.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2864 | #endif |
ram54288 | 0:dbad57390bd1 | 2865 | } |
ram54288 | 0:dbad57390bd1 | 2866 | |
ram54288 | 0:dbad57390bd1 | 2867 | void testFloatIsPosInf2(void) |
ram54288 | 0:dbad57390bd1 | 2868 | { |
ram54288 | 0:dbad57390bd1 | 2869 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2870 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2871 | #else |
ram54288 | 0:dbad57390bd1 | 2872 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2873 | TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2874 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2875 | #endif |
ram54288 | 0:dbad57390bd1 | 2876 | } |
ram54288 | 0:dbad57390bd1 | 2877 | |
ram54288 | 0:dbad57390bd1 | 2878 | void testFloatIsNegInf1(void) |
ram54288 | 0:dbad57390bd1 | 2879 | { |
ram54288 | 0:dbad57390bd1 | 2880 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2881 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2882 | #else |
ram54288 | 0:dbad57390bd1 | 2883 | TEST_ASSERT_FLOAT_IS_NEG_INF(-3.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2884 | #endif |
ram54288 | 0:dbad57390bd1 | 2885 | } |
ram54288 | 0:dbad57390bd1 | 2886 | |
ram54288 | 0:dbad57390bd1 | 2887 | void testFloatIsNegInf2(void) |
ram54288 | 0:dbad57390bd1 | 2888 | { |
ram54288 | 0:dbad57390bd1 | 2889 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2890 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2891 | #else |
ram54288 | 0:dbad57390bd1 | 2892 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2893 | TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(-3.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2894 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2895 | #endif |
ram54288 | 0:dbad57390bd1 | 2896 | } |
ram54288 | 0:dbad57390bd1 | 2897 | |
ram54288 | 0:dbad57390bd1 | 2898 | void testFloatIsNotPosInf1(void) |
ram54288 | 0:dbad57390bd1 | 2899 | { |
ram54288 | 0:dbad57390bd1 | 2900 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2901 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2902 | #else |
ram54288 | 0:dbad57390bd1 | 2903 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2904 | TEST_ASSERT_FLOAT_IS_INF(2.0f); |
ram54288 | 0:dbad57390bd1 | 2905 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2906 | #endif |
ram54288 | 0:dbad57390bd1 | 2907 | } |
ram54288 | 0:dbad57390bd1 | 2908 | |
ram54288 | 0:dbad57390bd1 | 2909 | void testFloatIsNotPosInf2(void) |
ram54288 | 0:dbad57390bd1 | 2910 | { |
ram54288 | 0:dbad57390bd1 | 2911 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2912 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2913 | #else |
ram54288 | 0:dbad57390bd1 | 2914 | TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f); |
ram54288 | 0:dbad57390bd1 | 2915 | #endif |
ram54288 | 0:dbad57390bd1 | 2916 | } |
ram54288 | 0:dbad57390bd1 | 2917 | |
ram54288 | 0:dbad57390bd1 | 2918 | void testFloatIsNotNegInf(void) |
ram54288 | 0:dbad57390bd1 | 2919 | { |
ram54288 | 0:dbad57390bd1 | 2920 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2921 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2922 | #else |
ram54288 | 0:dbad57390bd1 | 2923 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2924 | TEST_ASSERT_FLOAT_IS_NEG_INF(-999.876f); |
ram54288 | 0:dbad57390bd1 | 2925 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2926 | #endif |
ram54288 | 0:dbad57390bd1 | 2927 | } |
ram54288 | 0:dbad57390bd1 | 2928 | |
ram54288 | 0:dbad57390bd1 | 2929 | void testFloatIsNan1(void) |
ram54288 | 0:dbad57390bd1 | 2930 | { |
ram54288 | 0:dbad57390bd1 | 2931 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2932 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2933 | #else |
ram54288 | 0:dbad57390bd1 | 2934 | TEST_ASSERT_FLOAT_IS_NAN(0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2935 | #endif |
ram54288 | 0:dbad57390bd1 | 2936 | } |
ram54288 | 0:dbad57390bd1 | 2937 | |
ram54288 | 0:dbad57390bd1 | 2938 | void testFloatIsNan2(void) |
ram54288 | 0:dbad57390bd1 | 2939 | { |
ram54288 | 0:dbad57390bd1 | 2940 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2941 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2942 | #else |
ram54288 | 0:dbad57390bd1 | 2943 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2944 | TEST_ASSERT_FLOAT_IS_NOT_NAN(0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2945 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2946 | #endif |
ram54288 | 0:dbad57390bd1 | 2947 | } |
ram54288 | 0:dbad57390bd1 | 2948 | |
ram54288 | 0:dbad57390bd1 | 2949 | void testFloatIsNotNan1(void) |
ram54288 | 0:dbad57390bd1 | 2950 | { |
ram54288 | 0:dbad57390bd1 | 2951 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2952 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2953 | #else |
ram54288 | 0:dbad57390bd1 | 2954 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2955 | TEST_ASSERT_FLOAT_IS_NAN(234.9f); |
ram54288 | 0:dbad57390bd1 | 2956 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2957 | #endif |
ram54288 | 0:dbad57390bd1 | 2958 | } |
ram54288 | 0:dbad57390bd1 | 2959 | |
ram54288 | 0:dbad57390bd1 | 2960 | void testFloatIsNotNan2(void) |
ram54288 | 0:dbad57390bd1 | 2961 | { |
ram54288 | 0:dbad57390bd1 | 2962 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2963 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2964 | #else |
ram54288 | 0:dbad57390bd1 | 2965 | TEST_ASSERT_FLOAT_IS_NOT_NAN(234.9f); |
ram54288 | 0:dbad57390bd1 | 2966 | #endif |
ram54288 | 0:dbad57390bd1 | 2967 | } |
ram54288 | 0:dbad57390bd1 | 2968 | |
ram54288 | 0:dbad57390bd1 | 2969 | void testFloatInfIsNotNan(void) |
ram54288 | 0:dbad57390bd1 | 2970 | { |
ram54288 | 0:dbad57390bd1 | 2971 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2972 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2973 | #else |
ram54288 | 0:dbad57390bd1 | 2974 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2975 | TEST_ASSERT_FLOAT_IS_NAN(1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2976 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2977 | #endif |
ram54288 | 0:dbad57390bd1 | 2978 | } |
ram54288 | 0:dbad57390bd1 | 2979 | |
ram54288 | 0:dbad57390bd1 | 2980 | void testFloatNanIsNotInf(void) |
ram54288 | 0:dbad57390bd1 | 2981 | { |
ram54288 | 0:dbad57390bd1 | 2982 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2983 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2984 | #else |
ram54288 | 0:dbad57390bd1 | 2985 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 2986 | TEST_ASSERT_FLOAT_IS_INF(0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 2987 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 2988 | #endif |
ram54288 | 0:dbad57390bd1 | 2989 | } |
ram54288 | 0:dbad57390bd1 | 2990 | |
ram54288 | 0:dbad57390bd1 | 2991 | void testFloatIsDeterminate1(void) |
ram54288 | 0:dbad57390bd1 | 2992 | { |
ram54288 | 0:dbad57390bd1 | 2993 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 2994 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 2995 | #else |
ram54288 | 0:dbad57390bd1 | 2996 | TEST_ASSERT_FLOAT_IS_DETERMINATE(0.0f); |
ram54288 | 0:dbad57390bd1 | 2997 | TEST_ASSERT_FLOAT_IS_DETERMINATE(123.3f); |
ram54288 | 0:dbad57390bd1 | 2998 | TEST_ASSERT_FLOAT_IS_DETERMINATE(-88.3f); |
ram54288 | 0:dbad57390bd1 | 2999 | #endif |
ram54288 | 0:dbad57390bd1 | 3000 | } |
ram54288 | 0:dbad57390bd1 | 3001 | |
ram54288 | 0:dbad57390bd1 | 3002 | void testFloatIsDeterminate2(void) |
ram54288 | 0:dbad57390bd1 | 3003 | { |
ram54288 | 0:dbad57390bd1 | 3004 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3005 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3006 | #else |
ram54288 | 0:dbad57390bd1 | 3007 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3008 | TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(-88.3f); |
ram54288 | 0:dbad57390bd1 | 3009 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3010 | #endif |
ram54288 | 0:dbad57390bd1 | 3011 | } |
ram54288 | 0:dbad57390bd1 | 3012 | |
ram54288 | 0:dbad57390bd1 | 3013 | void testFloatIsNotDeterminate1(void) |
ram54288 | 0:dbad57390bd1 | 3014 | { |
ram54288 | 0:dbad57390bd1 | 3015 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3016 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3017 | #else |
ram54288 | 0:dbad57390bd1 | 3018 | TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 3019 | TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(-1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 3020 | TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(0.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 3021 | #endif |
ram54288 | 0:dbad57390bd1 | 3022 | } |
ram54288 | 0:dbad57390bd1 | 3023 | |
ram54288 | 0:dbad57390bd1 | 3024 | void testFloatIsNotDeterminate2(void) |
ram54288 | 0:dbad57390bd1 | 3025 | { |
ram54288 | 0:dbad57390bd1 | 3026 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3027 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3028 | #else |
ram54288 | 0:dbad57390bd1 | 3029 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3030 | TEST_ASSERT_FLOAT_IS_DETERMINATE(-1.0f / f_zero); |
ram54288 | 0:dbad57390bd1 | 3031 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3032 | #endif |
ram54288 | 0:dbad57390bd1 | 3033 | } |
ram54288 | 0:dbad57390bd1 | 3034 | |
ram54288 | 0:dbad57390bd1 | 3035 | void testFloatTraitFailsOnInvalidTrait(void) |
ram54288 | 0:dbad57390bd1 | 3036 | { |
ram54288 | 0:dbad57390bd1 | 3037 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3038 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3039 | #else |
ram54288 | 0:dbad57390bd1 | 3040 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3041 | UnityAssertFloatSpecial(1.0f, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT); |
ram54288 | 0:dbad57390bd1 | 3042 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3043 | #endif |
ram54288 | 0:dbad57390bd1 | 3044 | } |
ram54288 | 0:dbad57390bd1 | 3045 | |
ram54288 | 0:dbad57390bd1 | 3046 | |
ram54288 | 0:dbad57390bd1 | 3047 | void testEqualFloatArrays(void) |
ram54288 | 0:dbad57390bd1 | 3048 | { |
ram54288 | 0:dbad57390bd1 | 3049 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3050 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3051 | #else |
ram54288 | 0:dbad57390bd1 | 3052 | float p0[] = {1.0f, -8.0f, 25.4f, -0.123f}; |
ram54288 | 0:dbad57390bd1 | 3053 | float p1[] = {1.0f, -8.0f, 25.4f, -0.123f}; |
ram54288 | 0:dbad57390bd1 | 3054 | float p2[] = {1.0f, -8.0f, 25.4f, -0.2f}; |
ram54288 | 0:dbad57390bd1 | 3055 | float p3[] = {1.0f, -23.0f, 25.0f, -0.26f}; |
ram54288 | 0:dbad57390bd1 | 3056 | |
ram54288 | 0:dbad57390bd1 | 3057 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 3058 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 3059 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3060 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 3061 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 3062 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(NULL, NULL, 1); |
ram54288 | 0:dbad57390bd1 | 3063 | #endif |
ram54288 | 0:dbad57390bd1 | 3064 | } |
ram54288 | 0:dbad57390bd1 | 3065 | |
ram54288 | 0:dbad57390bd1 | 3066 | void testNotEqualFloatArraysExpectedNull(void) |
ram54288 | 0:dbad57390bd1 | 3067 | { |
ram54288 | 0:dbad57390bd1 | 3068 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3069 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3070 | #else |
ram54288 | 0:dbad57390bd1 | 3071 | float* p0 = NULL; |
ram54288 | 0:dbad57390bd1 | 3072 | float p1[] = {1.0f, 8.0f, 25.4f, 0.252f}; |
ram54288 | 0:dbad57390bd1 | 3073 | |
ram54288 | 0:dbad57390bd1 | 3074 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3075 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3076 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3077 | #endif |
ram54288 | 0:dbad57390bd1 | 3078 | } |
ram54288 | 0:dbad57390bd1 | 3079 | |
ram54288 | 0:dbad57390bd1 | 3080 | void testNotEqualFloatArraysActualNull(void) |
ram54288 | 0:dbad57390bd1 | 3081 | { |
ram54288 | 0:dbad57390bd1 | 3082 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3083 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3084 | #else |
ram54288 | 0:dbad57390bd1 | 3085 | float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3086 | float* p1 = NULL; |
ram54288 | 0:dbad57390bd1 | 3087 | |
ram54288 | 0:dbad57390bd1 | 3088 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3089 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3090 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3091 | #endif |
ram54288 | 0:dbad57390bd1 | 3092 | } |
ram54288 | 0:dbad57390bd1 | 3093 | |
ram54288 | 0:dbad57390bd1 | 3094 | void testNotEqualFloatArrays1(void) |
ram54288 | 0:dbad57390bd1 | 3095 | { |
ram54288 | 0:dbad57390bd1 | 3096 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3097 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3098 | #else |
ram54288 | 0:dbad57390bd1 | 3099 | float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3100 | float p1[] = {1.0f, 8.0f, 25.4f, 0.252f}; |
ram54288 | 0:dbad57390bd1 | 3101 | |
ram54288 | 0:dbad57390bd1 | 3102 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3103 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3104 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3105 | #endif |
ram54288 | 0:dbad57390bd1 | 3106 | } |
ram54288 | 0:dbad57390bd1 | 3107 | |
ram54288 | 0:dbad57390bd1 | 3108 | void testNotEqualFloatArrays2(void) |
ram54288 | 0:dbad57390bd1 | 3109 | { |
ram54288 | 0:dbad57390bd1 | 3110 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3111 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3112 | #else |
ram54288 | 0:dbad57390bd1 | 3113 | float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3114 | float p1[] = {2.0f, 8.0f, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3115 | |
ram54288 | 0:dbad57390bd1 | 3116 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3117 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3118 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3119 | #endif |
ram54288 | 0:dbad57390bd1 | 3120 | } |
ram54288 | 0:dbad57390bd1 | 3121 | |
ram54288 | 0:dbad57390bd1 | 3122 | void testNotEqualFloatArrays3(void) |
ram54288 | 0:dbad57390bd1 | 3123 | { |
ram54288 | 0:dbad57390bd1 | 3124 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3125 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3126 | #else |
ram54288 | 0:dbad57390bd1 | 3127 | float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3128 | float p1[] = {1.0f, 8.0f, 25.5f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3129 | |
ram54288 | 0:dbad57390bd1 | 3130 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3131 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3132 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3133 | #endif |
ram54288 | 0:dbad57390bd1 | 3134 | } |
ram54288 | 0:dbad57390bd1 | 3135 | |
ram54288 | 0:dbad57390bd1 | 3136 | void testNotEqualFloatArraysNegative1(void) |
ram54288 | 0:dbad57390bd1 | 3137 | { |
ram54288 | 0:dbad57390bd1 | 3138 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3139 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3140 | #else |
ram54288 | 0:dbad57390bd1 | 3141 | float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f}; |
ram54288 | 0:dbad57390bd1 | 3142 | float p1[] = {-1.0f, -8.0f, -25.4f, -0.252f}; |
ram54288 | 0:dbad57390bd1 | 3143 | |
ram54288 | 0:dbad57390bd1 | 3144 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3145 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3146 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3147 | #endif |
ram54288 | 0:dbad57390bd1 | 3148 | } |
ram54288 | 0:dbad57390bd1 | 3149 | |
ram54288 | 0:dbad57390bd1 | 3150 | void testNotEqualFloatArraysNegative2(void) |
ram54288 | 0:dbad57390bd1 | 3151 | { |
ram54288 | 0:dbad57390bd1 | 3152 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3153 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3154 | #else |
ram54288 | 0:dbad57390bd1 | 3155 | float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f}; |
ram54288 | 0:dbad57390bd1 | 3156 | float p1[] = {-2.0f, -8.0f, -25.4f, -0.253f}; |
ram54288 | 0:dbad57390bd1 | 3157 | |
ram54288 | 0:dbad57390bd1 | 3158 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3159 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3160 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3161 | #endif |
ram54288 | 0:dbad57390bd1 | 3162 | } |
ram54288 | 0:dbad57390bd1 | 3163 | |
ram54288 | 0:dbad57390bd1 | 3164 | void testNotEqualFloatArraysNegative3(void) |
ram54288 | 0:dbad57390bd1 | 3165 | { |
ram54288 | 0:dbad57390bd1 | 3166 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3167 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3168 | #else |
ram54288 | 0:dbad57390bd1 | 3169 | float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f}; |
ram54288 | 0:dbad57390bd1 | 3170 | float p1[] = {-1.0f, -8.0f, -25.5f, -0.253f}; |
ram54288 | 0:dbad57390bd1 | 3171 | |
ram54288 | 0:dbad57390bd1 | 3172 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3173 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3174 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3175 | #endif |
ram54288 | 0:dbad57390bd1 | 3176 | } |
ram54288 | 0:dbad57390bd1 | 3177 | |
ram54288 | 0:dbad57390bd1 | 3178 | void testNotEqualFloatArraysNaN(void) |
ram54288 | 0:dbad57390bd1 | 3179 | { |
ram54288 | 0:dbad57390bd1 | 3180 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3181 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3182 | #else |
ram54288 | 0:dbad57390bd1 | 3183 | float p0[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3184 | float p1[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3185 | |
ram54288 | 0:dbad57390bd1 | 3186 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3187 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3188 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3189 | #endif |
ram54288 | 0:dbad57390bd1 | 3190 | } |
ram54288 | 0:dbad57390bd1 | 3191 | |
ram54288 | 0:dbad57390bd1 | 3192 | void testNotEqualFloatArraysInf(void) |
ram54288 | 0:dbad57390bd1 | 3193 | { |
ram54288 | 0:dbad57390bd1 | 3194 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3195 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3196 | #else |
ram54288 | 0:dbad57390bd1 | 3197 | float p0[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3198 | float p1[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f}; |
ram54288 | 0:dbad57390bd1 | 3199 | |
ram54288 | 0:dbad57390bd1 | 3200 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3201 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3202 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3203 | #endif |
ram54288 | 0:dbad57390bd1 | 3204 | } |
ram54288 | 0:dbad57390bd1 | 3205 | |
ram54288 | 0:dbad57390bd1 | 3206 | void testNotEqualFloatArraysLengthZero(void) |
ram54288 | 0:dbad57390bd1 | 3207 | { |
ram54288 | 0:dbad57390bd1 | 3208 | #ifdef UNITY_EXCLUDE_FLOAT |
ram54288 | 0:dbad57390bd1 | 3209 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3210 | #else |
ram54288 | 0:dbad57390bd1 | 3211 | float p0[1] = {0.0f}; |
ram54288 | 0:dbad57390bd1 | 3212 | float p1[1] = {0.0f}; |
ram54288 | 0:dbad57390bd1 | 3213 | |
ram54288 | 0:dbad57390bd1 | 3214 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3215 | TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 0); |
ram54288 | 0:dbad57390bd1 | 3216 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3217 | #endif |
ram54288 | 0:dbad57390bd1 | 3218 | } |
ram54288 | 0:dbad57390bd1 | 3219 | |
ram54288 | 0:dbad57390bd1 | 3220 | // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES DOUBLE SUPPORT ================== |
ram54288 | 0:dbad57390bd1 | 3221 | |
ram54288 | 0:dbad57390bd1 | 3222 | void testDoublesWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 3223 | { |
ram54288 | 0:dbad57390bd1 | 3224 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3225 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3226 | #else |
ram54288 | 0:dbad57390bd1 | 3227 | TEST_ASSERT_DOUBLE_WITHIN(0.00003, 187245.03485, 187245.03488); |
ram54288 | 0:dbad57390bd1 | 3228 | TEST_ASSERT_DOUBLE_WITHIN(1.0, 187245.0, 187246.0); |
ram54288 | 0:dbad57390bd1 | 3229 | TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2549, 9273.2049); |
ram54288 | 0:dbad57390bd1 | 3230 | TEST_ASSERT_DOUBLE_WITHIN(0.007, -726.93725, -726.94424); |
ram54288 | 0:dbad57390bd1 | 3231 | #endif |
ram54288 | 0:dbad57390bd1 | 3232 | } |
ram54288 | 0:dbad57390bd1 | 3233 | |
ram54288 | 0:dbad57390bd1 | 3234 | void testDoublesNotWithinDelta(void) |
ram54288 | 0:dbad57390bd1 | 3235 | { |
ram54288 | 0:dbad57390bd1 | 3236 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3237 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3238 | #else |
ram54288 | 0:dbad57390bd1 | 3239 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3240 | TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2649, 9273.2049); |
ram54288 | 0:dbad57390bd1 | 3241 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3242 | #endif |
ram54288 | 0:dbad57390bd1 | 3243 | } |
ram54288 | 0:dbad57390bd1 | 3244 | |
ram54288 | 0:dbad57390bd1 | 3245 | |
ram54288 | 0:dbad57390bd1 | 3246 | void testDoublesEqual(void) |
ram54288 | 0:dbad57390bd1 | 3247 | { |
ram54288 | 0:dbad57390bd1 | 3248 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3249 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3250 | #else |
ram54288 | 0:dbad57390bd1 | 3251 | TEST_ASSERT_EQUAL_DOUBLE(187245123456.0, 187245123456.0); |
ram54288 | 0:dbad57390bd1 | 3252 | TEST_ASSERT_EQUAL_DOUBLE(187241234567.5, 187241234567.6); |
ram54288 | 0:dbad57390bd1 | 3253 | TEST_ASSERT_EQUAL_DOUBLE(9273.2512345649, 9273.25123455699); |
ram54288 | 0:dbad57390bd1 | 3254 | TEST_ASSERT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374); |
ram54288 | 0:dbad57390bd1 | 3255 | #endif |
ram54288 | 0:dbad57390bd1 | 3256 | } |
ram54288 | 0:dbad57390bd1 | 3257 | |
ram54288 | 0:dbad57390bd1 | 3258 | void testDoublesNotEqual(void) |
ram54288 | 0:dbad57390bd1 | 3259 | { |
ram54288 | 0:dbad57390bd1 | 3260 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3261 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3262 | #else |
ram54288 | 0:dbad57390bd1 | 3263 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3264 | TEST_ASSERT_EQUAL_DOUBLE(9273.9649, 9273.0049); |
ram54288 | 0:dbad57390bd1 | 3265 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3266 | #endif |
ram54288 | 0:dbad57390bd1 | 3267 | } |
ram54288 | 0:dbad57390bd1 | 3268 | |
ram54288 | 0:dbad57390bd1 | 3269 | void testDoublesNotEqualNegative1(void) |
ram54288 | 0:dbad57390bd1 | 3270 | { |
ram54288 | 0:dbad57390bd1 | 3271 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3272 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3273 | #else |
ram54288 | 0:dbad57390bd1 | 3274 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3275 | TEST_ASSERT_EQUAL_DOUBLE(-9273.9649, -9273.0049); |
ram54288 | 0:dbad57390bd1 | 3276 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3277 | #endif |
ram54288 | 0:dbad57390bd1 | 3278 | } |
ram54288 | 0:dbad57390bd1 | 3279 | |
ram54288 | 0:dbad57390bd1 | 3280 | void testDoublesNotEqualNegative2(void) |
ram54288 | 0:dbad57390bd1 | 3281 | { |
ram54288 | 0:dbad57390bd1 | 3282 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3283 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3284 | #else |
ram54288 | 0:dbad57390bd1 | 3285 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3286 | TEST_ASSERT_EQUAL_DOUBLE(-9273.0049, -9273.9649); |
ram54288 | 0:dbad57390bd1 | 3287 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3288 | #endif |
ram54288 | 0:dbad57390bd1 | 3289 | } |
ram54288 | 0:dbad57390bd1 | 3290 | |
ram54288 | 0:dbad57390bd1 | 3291 | void testDoublesNotEqualActualNaN(void) |
ram54288 | 0:dbad57390bd1 | 3292 | { |
ram54288 | 0:dbad57390bd1 | 3293 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3294 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3295 | #else |
ram54288 | 0:dbad57390bd1 | 3296 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3297 | TEST_ASSERT_EQUAL_DOUBLE(85.963, 0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3298 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3299 | #endif |
ram54288 | 0:dbad57390bd1 | 3300 | } |
ram54288 | 0:dbad57390bd1 | 3301 | |
ram54288 | 0:dbad57390bd1 | 3302 | void testDoublesNotEqualExpectedNaN(void) |
ram54288 | 0:dbad57390bd1 | 3303 | { |
ram54288 | 0:dbad57390bd1 | 3304 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3305 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3306 | #else |
ram54288 | 0:dbad57390bd1 | 3307 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3308 | TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 85.963); |
ram54288 | 0:dbad57390bd1 | 3309 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3310 | #endif |
ram54288 | 0:dbad57390bd1 | 3311 | } |
ram54288 | 0:dbad57390bd1 | 3312 | |
ram54288 | 0:dbad57390bd1 | 3313 | void testDoublesNotEqualBothNaN(void) |
ram54288 | 0:dbad57390bd1 | 3314 | { |
ram54288 | 0:dbad57390bd1 | 3315 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3316 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3317 | #else |
ram54288 | 0:dbad57390bd1 | 3318 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3319 | TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3320 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3321 | #endif |
ram54288 | 0:dbad57390bd1 | 3322 | } |
ram54288 | 0:dbad57390bd1 | 3323 | |
ram54288 | 0:dbad57390bd1 | 3324 | void testDoublesNotEqualInfNaN(void) |
ram54288 | 0:dbad57390bd1 | 3325 | { |
ram54288 | 0:dbad57390bd1 | 3326 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3327 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3328 | #else |
ram54288 | 0:dbad57390bd1 | 3329 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3330 | TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3331 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3332 | #endif |
ram54288 | 0:dbad57390bd1 | 3333 | } |
ram54288 | 0:dbad57390bd1 | 3334 | |
ram54288 | 0:dbad57390bd1 | 3335 | void testDoublesNotEqualNaNInf(void) |
ram54288 | 0:dbad57390bd1 | 3336 | { |
ram54288 | 0:dbad57390bd1 | 3337 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3338 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3339 | #else |
ram54288 | 0:dbad57390bd1 | 3340 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3341 | TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3342 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3343 | #endif |
ram54288 | 0:dbad57390bd1 | 3344 | } |
ram54288 | 0:dbad57390bd1 | 3345 | |
ram54288 | 0:dbad57390bd1 | 3346 | void testDoublesNotEqualActualInf(void) |
ram54288 | 0:dbad57390bd1 | 3347 | { |
ram54288 | 0:dbad57390bd1 | 3348 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3349 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3350 | #else |
ram54288 | 0:dbad57390bd1 | 3351 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3352 | TEST_ASSERT_EQUAL_DOUBLE(321.642, 1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3353 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3354 | #endif |
ram54288 | 0:dbad57390bd1 | 3355 | } |
ram54288 | 0:dbad57390bd1 | 3356 | |
ram54288 | 0:dbad57390bd1 | 3357 | void testDoublesNotEqualExpectedInf(void) |
ram54288 | 0:dbad57390bd1 | 3358 | { |
ram54288 | 0:dbad57390bd1 | 3359 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3360 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3361 | #else |
ram54288 | 0:dbad57390bd1 | 3362 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3363 | TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 321.642); |
ram54288 | 0:dbad57390bd1 | 3364 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3365 | #endif |
ram54288 | 0:dbad57390bd1 | 3366 | } |
ram54288 | 0:dbad57390bd1 | 3367 | |
ram54288 | 0:dbad57390bd1 | 3368 | void testDoublesNotEqualBothInf(void) |
ram54288 | 0:dbad57390bd1 | 3369 | { |
ram54288 | 0:dbad57390bd1 | 3370 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3371 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3372 | #else |
ram54288 | 0:dbad57390bd1 | 3373 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3374 | TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3375 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3376 | #endif |
ram54288 | 0:dbad57390bd1 | 3377 | } |
ram54288 | 0:dbad57390bd1 | 3378 | |
ram54288 | 0:dbad57390bd1 | 3379 | void testDoublesNotEqualPlusMinusInf(void) |
ram54288 | 0:dbad57390bd1 | 3380 | { |
ram54288 | 0:dbad57390bd1 | 3381 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3382 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3383 | #else |
ram54288 | 0:dbad57390bd1 | 3384 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3385 | TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3386 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3387 | #endif |
ram54288 | 0:dbad57390bd1 | 3388 | } |
ram54288 | 0:dbad57390bd1 | 3389 | |
ram54288 | 0:dbad57390bd1 | 3390 | void testDoubleIsPosInf1(void) |
ram54288 | 0:dbad57390bd1 | 3391 | { |
ram54288 | 0:dbad57390bd1 | 3392 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3393 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3394 | #else |
ram54288 | 0:dbad57390bd1 | 3395 | TEST_ASSERT_DOUBLE_IS_INF(2.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3396 | #endif |
ram54288 | 0:dbad57390bd1 | 3397 | } |
ram54288 | 0:dbad57390bd1 | 3398 | |
ram54288 | 0:dbad57390bd1 | 3399 | void testDoubleIsPosInf2(void) |
ram54288 | 0:dbad57390bd1 | 3400 | { |
ram54288 | 0:dbad57390bd1 | 3401 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3402 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3403 | #else |
ram54288 | 0:dbad57390bd1 | 3404 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3405 | TEST_ASSERT_DOUBLE_IS_NOT_INF(2.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3406 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3407 | #endif |
ram54288 | 0:dbad57390bd1 | 3408 | } |
ram54288 | 0:dbad57390bd1 | 3409 | |
ram54288 | 0:dbad57390bd1 | 3410 | void testDoubleIsNegInf1(void) |
ram54288 | 0:dbad57390bd1 | 3411 | { |
ram54288 | 0:dbad57390bd1 | 3412 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3413 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3414 | #else |
ram54288 | 0:dbad57390bd1 | 3415 | TEST_ASSERT_DOUBLE_IS_NEG_INF(-3.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3416 | #endif |
ram54288 | 0:dbad57390bd1 | 3417 | } |
ram54288 | 0:dbad57390bd1 | 3418 | |
ram54288 | 0:dbad57390bd1 | 3419 | void testDoubleIsNegInf2(void) |
ram54288 | 0:dbad57390bd1 | 3420 | { |
ram54288 | 0:dbad57390bd1 | 3421 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3422 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3423 | #else |
ram54288 | 0:dbad57390bd1 | 3424 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3425 | TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(-3.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3426 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3427 | #endif |
ram54288 | 0:dbad57390bd1 | 3428 | } |
ram54288 | 0:dbad57390bd1 | 3429 | |
ram54288 | 0:dbad57390bd1 | 3430 | void testDoubleIsNotPosInf1(void) |
ram54288 | 0:dbad57390bd1 | 3431 | { |
ram54288 | 0:dbad57390bd1 | 3432 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3433 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3434 | #else |
ram54288 | 0:dbad57390bd1 | 3435 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3436 | TEST_ASSERT_DOUBLE_IS_INF(2.0); |
ram54288 | 0:dbad57390bd1 | 3437 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3438 | #endif |
ram54288 | 0:dbad57390bd1 | 3439 | } |
ram54288 | 0:dbad57390bd1 | 3440 | |
ram54288 | 0:dbad57390bd1 | 3441 | void testDoubleIsNotPosInf2(void) |
ram54288 | 0:dbad57390bd1 | 3442 | { |
ram54288 | 0:dbad57390bd1 | 3443 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3444 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3445 | #else |
ram54288 | 0:dbad57390bd1 | 3446 | TEST_ASSERT_DOUBLE_IS_NOT_INF(2.0); |
ram54288 | 0:dbad57390bd1 | 3447 | #endif |
ram54288 | 0:dbad57390bd1 | 3448 | } |
ram54288 | 0:dbad57390bd1 | 3449 | |
ram54288 | 0:dbad57390bd1 | 3450 | void testDoubleIsNotNegInf(void) |
ram54288 | 0:dbad57390bd1 | 3451 | { |
ram54288 | 0:dbad57390bd1 | 3452 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3453 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3454 | #else |
ram54288 | 0:dbad57390bd1 | 3455 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3456 | TEST_ASSERT_DOUBLE_IS_NEG_INF(-999.876); |
ram54288 | 0:dbad57390bd1 | 3457 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3458 | #endif |
ram54288 | 0:dbad57390bd1 | 3459 | } |
ram54288 | 0:dbad57390bd1 | 3460 | |
ram54288 | 0:dbad57390bd1 | 3461 | void testDoubleIsNan1(void) |
ram54288 | 0:dbad57390bd1 | 3462 | { |
ram54288 | 0:dbad57390bd1 | 3463 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3464 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3465 | #else |
ram54288 | 0:dbad57390bd1 | 3466 | TEST_ASSERT_DOUBLE_IS_NAN(0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3467 | #endif |
ram54288 | 0:dbad57390bd1 | 3468 | } |
ram54288 | 0:dbad57390bd1 | 3469 | |
ram54288 | 0:dbad57390bd1 | 3470 | void testDoubleIsNan2(void) |
ram54288 | 0:dbad57390bd1 | 3471 | { |
ram54288 | 0:dbad57390bd1 | 3472 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3473 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3474 | #else |
ram54288 | 0:dbad57390bd1 | 3475 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3476 | TEST_ASSERT_DOUBLE_IS_NOT_NAN(0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3477 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3478 | #endif |
ram54288 | 0:dbad57390bd1 | 3479 | } |
ram54288 | 0:dbad57390bd1 | 3480 | |
ram54288 | 0:dbad57390bd1 | 3481 | void testDoubleIsNotNan1(void) |
ram54288 | 0:dbad57390bd1 | 3482 | { |
ram54288 | 0:dbad57390bd1 | 3483 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3484 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3485 | #else |
ram54288 | 0:dbad57390bd1 | 3486 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3487 | TEST_ASSERT_DOUBLE_IS_NAN(234.9); |
ram54288 | 0:dbad57390bd1 | 3488 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3489 | #endif |
ram54288 | 0:dbad57390bd1 | 3490 | } |
ram54288 | 0:dbad57390bd1 | 3491 | |
ram54288 | 0:dbad57390bd1 | 3492 | void testDoubleIsNotNan2(void) |
ram54288 | 0:dbad57390bd1 | 3493 | { |
ram54288 | 0:dbad57390bd1 | 3494 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3495 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3496 | #else |
ram54288 | 0:dbad57390bd1 | 3497 | TEST_ASSERT_DOUBLE_IS_NOT_NAN(234.9); |
ram54288 | 0:dbad57390bd1 | 3498 | #endif |
ram54288 | 0:dbad57390bd1 | 3499 | } |
ram54288 | 0:dbad57390bd1 | 3500 | |
ram54288 | 0:dbad57390bd1 | 3501 | void testDoubleInfIsNotNan(void) |
ram54288 | 0:dbad57390bd1 | 3502 | { |
ram54288 | 0:dbad57390bd1 | 3503 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3504 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3505 | #else |
ram54288 | 0:dbad57390bd1 | 3506 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3507 | TEST_ASSERT_DOUBLE_IS_NAN(1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3508 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3509 | #endif |
ram54288 | 0:dbad57390bd1 | 3510 | } |
ram54288 | 0:dbad57390bd1 | 3511 | |
ram54288 | 0:dbad57390bd1 | 3512 | void testDoubleNanIsNotInf(void) |
ram54288 | 0:dbad57390bd1 | 3513 | { |
ram54288 | 0:dbad57390bd1 | 3514 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3515 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3516 | #else |
ram54288 | 0:dbad57390bd1 | 3517 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3518 | TEST_ASSERT_DOUBLE_IS_INF(0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3519 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3520 | #endif |
ram54288 | 0:dbad57390bd1 | 3521 | } |
ram54288 | 0:dbad57390bd1 | 3522 | |
ram54288 | 0:dbad57390bd1 | 3523 | void testDoubleIsDeterminate1(void) |
ram54288 | 0:dbad57390bd1 | 3524 | { |
ram54288 | 0:dbad57390bd1 | 3525 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3526 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3527 | #else |
ram54288 | 0:dbad57390bd1 | 3528 | TEST_ASSERT_DOUBLE_IS_DETERMINATE(0.0); |
ram54288 | 0:dbad57390bd1 | 3529 | TEST_ASSERT_DOUBLE_IS_DETERMINATE(123.3); |
ram54288 | 0:dbad57390bd1 | 3530 | TEST_ASSERT_DOUBLE_IS_DETERMINATE(-88.3); |
ram54288 | 0:dbad57390bd1 | 3531 | #endif |
ram54288 | 0:dbad57390bd1 | 3532 | } |
ram54288 | 0:dbad57390bd1 | 3533 | |
ram54288 | 0:dbad57390bd1 | 3534 | void testDoubleIsDeterminate2(void) |
ram54288 | 0:dbad57390bd1 | 3535 | { |
ram54288 | 0:dbad57390bd1 | 3536 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3537 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3538 | #else |
ram54288 | 0:dbad57390bd1 | 3539 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3540 | TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(-88.3); |
ram54288 | 0:dbad57390bd1 | 3541 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3542 | #endif |
ram54288 | 0:dbad57390bd1 | 3543 | } |
ram54288 | 0:dbad57390bd1 | 3544 | |
ram54288 | 0:dbad57390bd1 | 3545 | void testDoubleIsNotDeterminate1(void) |
ram54288 | 0:dbad57390bd1 | 3546 | { |
ram54288 | 0:dbad57390bd1 | 3547 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3548 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3549 | #else |
ram54288 | 0:dbad57390bd1 | 3550 | TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3551 | TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(-1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3552 | TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(0.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3553 | #endif |
ram54288 | 0:dbad57390bd1 | 3554 | } |
ram54288 | 0:dbad57390bd1 | 3555 | |
ram54288 | 0:dbad57390bd1 | 3556 | void testDoubleIsNotDeterminate2(void) |
ram54288 | 0:dbad57390bd1 | 3557 | { |
ram54288 | 0:dbad57390bd1 | 3558 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3559 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3560 | #else |
ram54288 | 0:dbad57390bd1 | 3561 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3562 | TEST_ASSERT_DOUBLE_IS_DETERMINATE(-1.0 / d_zero); |
ram54288 | 0:dbad57390bd1 | 3563 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3564 | #endif |
ram54288 | 0:dbad57390bd1 | 3565 | } |
ram54288 | 0:dbad57390bd1 | 3566 | |
ram54288 | 0:dbad57390bd1 | 3567 | void testDoubleTraitFailsOnInvalidTrait(void) |
ram54288 | 0:dbad57390bd1 | 3568 | { |
ram54288 | 0:dbad57390bd1 | 3569 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3570 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3571 | #else |
ram54288 | 0:dbad57390bd1 | 3572 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3573 | UnityAssertDoubleSpecial(1.0, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT); |
ram54288 | 0:dbad57390bd1 | 3574 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3575 | #endif |
ram54288 | 0:dbad57390bd1 | 3576 | } |
ram54288 | 0:dbad57390bd1 | 3577 | |
ram54288 | 0:dbad57390bd1 | 3578 | void testEqualDoubleArrays(void) |
ram54288 | 0:dbad57390bd1 | 3579 | { |
ram54288 | 0:dbad57390bd1 | 3580 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3581 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3582 | #else |
ram54288 | 0:dbad57390bd1 | 3583 | double p0[] = {1.0, -8.0, 25.4, -0.123}; |
ram54288 | 0:dbad57390bd1 | 3584 | double p1[] = {1.0, -8.0, 25.4, -0.123}; |
ram54288 | 0:dbad57390bd1 | 3585 | double p2[] = {1.0, -8.0, 25.4, -0.2}; |
ram54288 | 0:dbad57390bd1 | 3586 | double p3[] = {1.0, -23.0, 25.0, -0.26}; |
ram54288 | 0:dbad57390bd1 | 3587 | |
ram54288 | 0:dbad57390bd1 | 3588 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 1); |
ram54288 | 0:dbad57390bd1 | 3589 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 4); |
ram54288 | 0:dbad57390bd1 | 3590 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3591 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p2, 3); |
ram54288 | 0:dbad57390bd1 | 3592 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p3, 1); |
ram54288 | 0:dbad57390bd1 | 3593 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(NULL, NULL, 1); |
ram54288 | 0:dbad57390bd1 | 3594 | #endif |
ram54288 | 0:dbad57390bd1 | 3595 | } |
ram54288 | 0:dbad57390bd1 | 3596 | |
ram54288 | 0:dbad57390bd1 | 3597 | void testNotEqualDoubleArraysExpectedNull(void) |
ram54288 | 0:dbad57390bd1 | 3598 | { |
ram54288 | 0:dbad57390bd1 | 3599 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3600 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3601 | #else |
ram54288 | 0:dbad57390bd1 | 3602 | double* p0 = NULL; |
ram54288 | 0:dbad57390bd1 | 3603 | double p1[] = {1.0, 8.0, 25.4, 0.252}; |
ram54288 | 0:dbad57390bd1 | 3604 | |
ram54288 | 0:dbad57390bd1 | 3605 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3606 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3607 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3608 | #endif |
ram54288 | 0:dbad57390bd1 | 3609 | } |
ram54288 | 0:dbad57390bd1 | 3610 | |
ram54288 | 0:dbad57390bd1 | 3611 | void testNotEqualDoubleArraysActualNull(void) |
ram54288 | 0:dbad57390bd1 | 3612 | { |
ram54288 | 0:dbad57390bd1 | 3613 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3614 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3615 | #else |
ram54288 | 0:dbad57390bd1 | 3616 | double p0[] = {1.0, 8.0, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3617 | double* p1 = NULL; |
ram54288 | 0:dbad57390bd1 | 3618 | |
ram54288 | 0:dbad57390bd1 | 3619 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3620 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3621 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3622 | #endif |
ram54288 | 0:dbad57390bd1 | 3623 | } |
ram54288 | 0:dbad57390bd1 | 3624 | |
ram54288 | 0:dbad57390bd1 | 3625 | void testNotEqualDoubleArrays1(void) |
ram54288 | 0:dbad57390bd1 | 3626 | { |
ram54288 | 0:dbad57390bd1 | 3627 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3628 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3629 | #else |
ram54288 | 0:dbad57390bd1 | 3630 | double p0[] = {1.0, 8.0, 25.4, 0.25666666667}; |
ram54288 | 0:dbad57390bd1 | 3631 | double p1[] = {1.0, 8.0, 25.4, 0.25666666666}; |
ram54288 | 0:dbad57390bd1 | 3632 | |
ram54288 | 0:dbad57390bd1 | 3633 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3634 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3635 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3636 | #endif |
ram54288 | 0:dbad57390bd1 | 3637 | } |
ram54288 | 0:dbad57390bd1 | 3638 | |
ram54288 | 0:dbad57390bd1 | 3639 | void testNotEqualDoubleArrays2(void) |
ram54288 | 0:dbad57390bd1 | 3640 | { |
ram54288 | 0:dbad57390bd1 | 3641 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3642 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3643 | #else |
ram54288 | 0:dbad57390bd1 | 3644 | double p0[] = {1.0, 8.0, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3645 | double p1[] = {2.0, 8.0, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3646 | |
ram54288 | 0:dbad57390bd1 | 3647 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3648 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3649 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3650 | #endif |
ram54288 | 0:dbad57390bd1 | 3651 | } |
ram54288 | 0:dbad57390bd1 | 3652 | |
ram54288 | 0:dbad57390bd1 | 3653 | void testNotEqualDoubleArrays3(void) |
ram54288 | 0:dbad57390bd1 | 3654 | { |
ram54288 | 0:dbad57390bd1 | 3655 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3656 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3657 | #else |
ram54288 | 0:dbad57390bd1 | 3658 | double p0[] = {1.0, 8.0, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3659 | double p1[] = {1.0, 8.0, 25.5, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3660 | |
ram54288 | 0:dbad57390bd1 | 3661 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3662 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3663 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3664 | #endif |
ram54288 | 0:dbad57390bd1 | 3665 | } |
ram54288 | 0:dbad57390bd1 | 3666 | |
ram54288 | 0:dbad57390bd1 | 3667 | void testNotEqualDoubleArraysNegative1(void) |
ram54288 | 0:dbad57390bd1 | 3668 | { |
ram54288 | 0:dbad57390bd1 | 3669 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3670 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3671 | #else |
ram54288 | 0:dbad57390bd1 | 3672 | double p0[] = {-1.0, -8.0, -25.4, -0.2566666667}; |
ram54288 | 0:dbad57390bd1 | 3673 | double p1[] = {-1.0, -8.0, -25.4, -0.2566666666}; |
ram54288 | 0:dbad57390bd1 | 3674 | |
ram54288 | 0:dbad57390bd1 | 3675 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3676 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3677 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3678 | #endif |
ram54288 | 0:dbad57390bd1 | 3679 | } |
ram54288 | 0:dbad57390bd1 | 3680 | |
ram54288 | 0:dbad57390bd1 | 3681 | void testNotEqualDoubleArraysNegative2(void) |
ram54288 | 0:dbad57390bd1 | 3682 | { |
ram54288 | 0:dbad57390bd1 | 3683 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3684 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3685 | #else |
ram54288 | 0:dbad57390bd1 | 3686 | double p0[] = {-1.0, -8.0, -25.4, -0.253}; |
ram54288 | 0:dbad57390bd1 | 3687 | double p1[] = {-2.0, -8.0, -25.4, -0.253}; |
ram54288 | 0:dbad57390bd1 | 3688 | |
ram54288 | 0:dbad57390bd1 | 3689 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3690 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3691 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3692 | #endif |
ram54288 | 0:dbad57390bd1 | 3693 | } |
ram54288 | 0:dbad57390bd1 | 3694 | |
ram54288 | 0:dbad57390bd1 | 3695 | void testNotEqualDoubleArraysNegative3(void) |
ram54288 | 0:dbad57390bd1 | 3696 | { |
ram54288 | 0:dbad57390bd1 | 3697 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3698 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3699 | #else |
ram54288 | 0:dbad57390bd1 | 3700 | double p0[] = {-1.0, -8.0, -25.4, -0.253}; |
ram54288 | 0:dbad57390bd1 | 3701 | double p1[] = {-1.0, -8.0, -25.5, -0.253}; |
ram54288 | 0:dbad57390bd1 | 3702 | |
ram54288 | 0:dbad57390bd1 | 3703 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3704 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3705 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3706 | #endif |
ram54288 | 0:dbad57390bd1 | 3707 | } |
ram54288 | 0:dbad57390bd1 | 3708 | |
ram54288 | 0:dbad57390bd1 | 3709 | void testNotEqualDoubleArraysNaN(void) |
ram54288 | 0:dbad57390bd1 | 3710 | { |
ram54288 | 0:dbad57390bd1 | 3711 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3712 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3713 | #else |
ram54288 | 0:dbad57390bd1 | 3714 | double p0[] = {1.0, 0.0 / d_zero, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3715 | double p1[] = {1.0, 0.0 / d_zero, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3716 | |
ram54288 | 0:dbad57390bd1 | 3717 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3718 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3719 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3720 | #endif |
ram54288 | 0:dbad57390bd1 | 3721 | } |
ram54288 | 0:dbad57390bd1 | 3722 | |
ram54288 | 0:dbad57390bd1 | 3723 | void testNotEqualDoubleArraysInf(void) |
ram54288 | 0:dbad57390bd1 | 3724 | { |
ram54288 | 0:dbad57390bd1 | 3725 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3726 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3727 | #else |
ram54288 | 0:dbad57390bd1 | 3728 | double p0[] = {1.0, 1.0 / d_zero, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3729 | double p1[] = {1.0, 1.0 / d_zero, 25.4, 0.253}; |
ram54288 | 0:dbad57390bd1 | 3730 | |
ram54288 | 0:dbad57390bd1 | 3731 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3732 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); |
ram54288 | 0:dbad57390bd1 | 3733 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3734 | #endif |
ram54288 | 0:dbad57390bd1 | 3735 | } |
ram54288 | 0:dbad57390bd1 | 3736 | |
ram54288 | 0:dbad57390bd1 | 3737 | void testNotEqualDoubleArraysLengthZero(void) |
ram54288 | 0:dbad57390bd1 | 3738 | { |
ram54288 | 0:dbad57390bd1 | 3739 | #ifdef UNITY_EXCLUDE_DOUBLE |
ram54288 | 0:dbad57390bd1 | 3740 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3741 | #else |
ram54288 | 0:dbad57390bd1 | 3742 | double p0[1] = {0.0}; |
ram54288 | 0:dbad57390bd1 | 3743 | double p1[1] = {0.0}; |
ram54288 | 0:dbad57390bd1 | 3744 | |
ram54288 | 0:dbad57390bd1 | 3745 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3746 | TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 0); |
ram54288 | 0:dbad57390bd1 | 3747 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3748 | #endif |
ram54288 | 0:dbad57390bd1 | 3749 | } |
ram54288 | 0:dbad57390bd1 | 3750 | |
ram54288 | 0:dbad57390bd1 | 3751 | // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES DETAIL SUPPORT ================== |
ram54288 | 0:dbad57390bd1 | 3752 | |
ram54288 | 0:dbad57390bd1 | 3753 | void testThatDetailsCanBeHandleOneDetail(void) |
ram54288 | 0:dbad57390bd1 | 3754 | { |
ram54288 | 0:dbad57390bd1 | 3755 | #ifdef UNITY_EXCLUDE_DETAILS |
ram54288 | 0:dbad57390bd1 | 3756 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3757 | #else |
ram54288 | 0:dbad57390bd1 | 3758 | UNITY_SET_DETAIL("Detail1"); |
ram54288 | 0:dbad57390bd1 | 3759 | |
ram54288 | 0:dbad57390bd1 | 3760 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3761 | TEST_ASSERT_EQUAL_INT_MESSAGE(5, 6, "Should Fail And Say Detail1"); |
ram54288 | 0:dbad57390bd1 | 3762 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3763 | #endif |
ram54288 | 0:dbad57390bd1 | 3764 | } |
ram54288 | 0:dbad57390bd1 | 3765 | |
ram54288 | 0:dbad57390bd1 | 3766 | void testThatDetailsCanHandleTestFail(void) |
ram54288 | 0:dbad57390bd1 | 3767 | { |
ram54288 | 0:dbad57390bd1 | 3768 | #ifdef UNITY_EXCLUDE_DETAILS |
ram54288 | 0:dbad57390bd1 | 3769 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3770 | #else |
ram54288 | 0:dbad57390bd1 | 3771 | UNITY_SET_DETAILS("Detail1","Detail2"); |
ram54288 | 0:dbad57390bd1 | 3772 | |
ram54288 | 0:dbad57390bd1 | 3773 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3774 | TEST_FAIL_MESSAGE("Should Fail And Say Detail1 and Detail2"); |
ram54288 | 0:dbad57390bd1 | 3775 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3776 | #endif |
ram54288 | 0:dbad57390bd1 | 3777 | } |
ram54288 | 0:dbad57390bd1 | 3778 | |
ram54288 | 0:dbad57390bd1 | 3779 | void testThatDetailsCanBeHandleTwoDetails(void) |
ram54288 | 0:dbad57390bd1 | 3780 | { |
ram54288 | 0:dbad57390bd1 | 3781 | #ifdef UNITY_EXCLUDE_DETAILS |
ram54288 | 0:dbad57390bd1 | 3782 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3783 | #else |
ram54288 | 0:dbad57390bd1 | 3784 | UNITY_SET_DETAILS("Detail1","Detail2"); |
ram54288 | 0:dbad57390bd1 | 3785 | |
ram54288 | 0:dbad57390bd1 | 3786 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3787 | TEST_ASSERT_EQUAL_HEX8_MESSAGE(7, 8, "Should Fail And Say Detail1 and Detail2"); |
ram54288 | 0:dbad57390bd1 | 3788 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3789 | #endif |
ram54288 | 0:dbad57390bd1 | 3790 | } |
ram54288 | 0:dbad57390bd1 | 3791 | |
ram54288 | 0:dbad57390bd1 | 3792 | void testThatDetailsCanBeHandleSingleDetailClearingTwoDetails(void) |
ram54288 | 0:dbad57390bd1 | 3793 | { |
ram54288 | 0:dbad57390bd1 | 3794 | #ifdef UNITY_EXCLUDE_DETAILS |
ram54288 | 0:dbad57390bd1 | 3795 | TEST_IGNORE(); |
ram54288 | 0:dbad57390bd1 | 3796 | #else |
ram54288 | 0:dbad57390bd1 | 3797 | UNITY_SET_DETAILS("Detail1","Detail2"); |
ram54288 | 0:dbad57390bd1 | 3798 | UNITY_SET_DETAIL("DetailNew"); |
ram54288 | 0:dbad57390bd1 | 3799 | |
ram54288 | 0:dbad57390bd1 | 3800 | EXPECT_ABORT_BEGIN |
ram54288 | 0:dbad57390bd1 | 3801 | TEST_ASSERT_EQUAL_STRING_MESSAGE("MEH", "GUH", "Should Fail And Say DetailNew"); |
ram54288 | 0:dbad57390bd1 | 3802 | VERIFY_FAILS_END |
ram54288 | 0:dbad57390bd1 | 3803 | #endif |
ram54288 | 0:dbad57390bd1 | 3804 | } |