Lines Matching +full:- +full:error +full:- +full:asserts
7 - An assertion establishes truth (i.e. boolean True) for a single condition.
9 - Unity is mainly a rich collection of assertions and the support to gather up
11 - The structure of Unity allows you to easily separate test assertions from
13 - Unity’s assertions:
14 - Come in many, many flavors to handle different C types and assertion cases.
15 - Use context to provide detailed and helpful failure messages.
16 - Document types, expected values, and basic behavior in your source code for
28 At their core, assertions are an establishment of truth - boolean truth. Was this
29 thing equal to that thing? Does that code doohickey have such-and-such property
33 error through some appropriate I/O channel (e.g. stdout, GUI, output file,
39 department. C’s `assert()` is pretty dumb as-is and is particularly poor for
50 readable, bit-level feedback when an assertion fails?
52 That’s what Unity’s collection of assertions do - capture context to give you
56 tests pass, you have a detailed, up-to-date view of the intent and mechanisms in
57 your source code. And due to a wondrous mystery, well-tested code usually tends
73 - `Actual` is the value being tested and unlike the other parameters in an
75 - `Modifiers` are masks, ranges, bit flag specifiers, floating point deltas.
76 - `Expected` is your expected value (duh) to compare to an `actual` value; it’s
79 - `Size/count` refers to string lengths, number of array elements, etc.
110 - The `_MESSAGE` variants intentionally do not support `printf` style formatting
114 - If you want to output a counter value within an assertion fail message (e.g. from
122 with the `_MESSAGE`variants of Unity’s Asserts in that for pretty much any Unity
130 - `Expected` is an array itself.
131 - `Size/count` is one or two parameters necessary to establish the number of array
136 - The `_MESSAGE` variant convention still applies here to array assertions. The
139 - Assertions for handling arrays of floating point values are grouped with float
147 variants of Unity’s Asserts in that for pretty much any Unity type assertion you
154 - `Expected` is a single value to compare to.
155 - `Actual` is an array where each element will be compared to the expected value.
156 - `Size/count` is one of two parameters necessary to establish the number of array
161 - The `_MESSAGE` variant convention still applies here to Each Equal assertions.
162 - Assertions for handling Each Equal of floating point values are grouped with
196 - Executing a state machine multiple times that increments a counter your test
198 - Triggering an exception and verifying it (as in Try / Catch / Throw - see the
250 is particularly useful for checking for empty (or non-empty) null-terminated
251 C strings, but can be just as easily used for other null-terminated arrays.
300 While you can use the 8-bit integer assertions to compare `char`, another option is
306 ### Masked and Bit-level Assertions
308 Masked and bit-level assertions produce output formatted in hexadecimal. Unity
317 Asserts the masked bits of the `actual` parameter are high.
321 Asserts the masked bits of the `actual` parameter are low.
325 Asserts the specified bit of the `actual` parameter is high.
329 Asserts the specified bit of the `actual` parameter is low.
350 These assertions verify that the `expected` parameter is within +/- `delta`
353 of 7 - 13.
391 Asserts that the pointers point to the same memory location.
395 Asserts that the null terminated (`’\0’`)strings are identical. If strings are
402 Asserts that the contents of the memory specified by the `expected` and `actual`
462 These assertions verify that the `expected` array parameter is within +/- `delta`
465 outside the range of \[7 - 13, 9 - 15\].
554 Asserts that the `actual` value is within +/- `delta` of the `expected` value.
560 Asserts that the `actual` value is NOT within +/- `delta` of the `expected` value.
564 Asserts that the `actual` value is “close enough to be considered equal” to the
566 Asserting section for more details on this. Omitting a user-specified delta in a
572 Asserts that the `actual` value is NOT “close enough to be considered equal” to the
578 uses user-provided delta plus default comparison delta for checking
585 specified delta comparison values requires a custom-implemented floating point
590 Asserts that the `actual` parameter is less than `threshold` (exclusive).
596 Asserts that the `actual` parameter is greater than `threshold` (exclusive).
602 Asserts that the `actual` parameter is less than or equal to `threshold`.
607 Asserts that the `actual` parameter is greater than `threshold`.
612 Asserts that `actual` parameter is equivalent to positive infinity floating
617 Asserts that `actual` parameter is equivalent to negative infinity floating
622 Asserts that `actual` parameter is a Not A Number floating point representation.
626 Asserts that `actual` parameter is a floating point representation usable for
632 Asserts that `actual` parameter is a value other than positive infinity floating
637 Asserts that `actual` parameter is a value other than negative infinity floating
642 Asserts that `actual` parameter is a value other than Not A Number floating
647 Asserts that `actual` parameter is not usable for mathematical operations. That
655 Asserts that the `actual` value is within +/- `delta` of the `expected` value.
661 Asserts that the `actual` value is NOT within +/- `delta` of the `expected` value.
665 Asserts that the `actual` value is “close enough to be considered equal” to the
667 Asserting section for more details. Omitting a user-specified delta in a
673 Asserts that the `actual` value is NOT “close enough to be considered equal” to the
679 uses user-provided delta plus default comparison delta for checking
691 Asserts that the `actual` parameter is less than `threshold` (exclusive).
697 Asserts that the `actual` parameter is less than or equal to `threshold`.
702 Asserts that the `actual` parameter is greater than `threshold` (exclusive).
708 Asserts that the `actual` parameter is greater than or equal to `threshold`.
713 Asserts that `actual` parameter is equivalent to positive infinity floating
718 Asserts that `actual` parameter is equivalent to negative infinity floating point
723 Asserts that `actual` parameter is a Not A Number floating point representation.
727 Asserts that `actual` parameter is a floating point representation usable for
733 Asserts that `actual` parameter is a value other than positive infinity floating
738 Asserts that `actual` parameter is a value other than negative infinity floating
743 Asserts that `actual` parameter is a value other than Not A Number floating
748 Asserts that `actual` parameter is not usable for mathematical operations. That
756 the under-the-hood details of Unity’s assertion mechanisms. If you’re one of
763 pair of doubles is sloppy at best and an outright no-no at worst. Floating point
767 mathematical operations might result in a representation of 8 x 2-2
781 works out to be roughly a single bit of range for a single-precision number, and
785 So what happens when it’s zero? Zero - even more than other floating point
786 values - can be represented many different ways. It doesn’t matter if you have
792 approximating a single bit of error.
799 ### How do we deal with targets with non-standard int sizes?
803 natural register size, and it should be at least 16-bits and a multiple of a
810 Most often, `int` is 32-bits. In many cases in the embedded world, `int` is
811 16-bits. There are rare microcontrollers out there that have 24-bit integers,
815 that have a hard choice to make. What if their natural register size is 10-bits
816 or 12-bits? Clearly they can’t fulfill _both_ the requirement to be at least
817 16-bits AND the requirement to match the natural register size. In these
828 When the C99 standard rolled around, it introduced alternate standard-size types.
845 24-bit `int`? The simplest solution is to use the next size up. If you have a
846 24-bit `int`, configure Unity to use 32-bit integers. If you have a 12-bit