Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bryantaylor 0:eafc3fd41f75 1 # UNITY: Unit Testing for C
bryantaylor 0:eafc3fd41f75 2
bryantaylor 0:eafc3fd41f75 3 This yotta module is a fork of the [UNITY test framework](http://www.throwtheswitch.org/unity/) with minor modifications to be able to use it with the [utest harness](https://github.com/ARMmbed/utest) for mbed OS.
bryantaylor 0:eafc3fd41f75 4
bryantaylor 0:eafc3fd41f75 5 Please note that this module only contains the unity test macros, and no additions such as the unity fixtures.
bryantaylor 0:eafc3fd41f75 6 Furthermore the failure macros have been modified to integrate with `utest` failure handlers, as `setjmp` and `longjmp` are not supported by `utest`.
bryantaylor 0:eafc3fd41f75 7
bryantaylor 0:eafc3fd41f75 8 Specifically
bryantaylor 0:eafc3fd41f75 9 - `UNITY_FAIL_AND_BAIL` calls `utest_unity_assert_failure()`, and
bryantaylor 0:eafc3fd41f75 10 - `UNITY_IGNORE_AND_BAIL` calls `utest_unity_ignore_failure()`
bryantaylor 0:eafc3fd41f75 11
bryantaylor 0:eafc3fd41f75 12 which then invoke the appropriate action in `utest`.
bryantaylor 0:eafc3fd41f75 13
bryantaylor 0:eafc3fd41f75 14 **To use these macros you need to depend on both `unity` and `utest`!**
bryantaylor 0:eafc3fd41f75 15
bryantaylor 0:eafc3fd41f75 16 For the original documentation of UNITY, please [visit the project's homepage](http://www.throwtheswitch.org/unity/).
bryantaylor 0:eafc3fd41f75 17
bryantaylor 0:eafc3fd41f75 18 ## Macros
bryantaylor 0:eafc3fd41f75 19
bryantaylor 0:eafc3fd41f75 20 UNITY provides a lot of test macros.
bryantaylor 0:eafc3fd41f75 21
bryantaylor 0:eafc3fd41f75 22 **Be aware of the macro argument order**: (EXPECTED VALUE, ACTUAL VALUE).
bryantaylor 0:eafc3fd41f75 23 So `TEST_ASSERT_EQUAL(4, value);` is the right way around.
bryantaylor 0:eafc3fd41f75 24
bryantaylor 0:eafc3fd41f75 25 Note, that you can provide a custom failure message by appending `_MESSAGE` to any macro and passing the message string as the _last argument_.
bryantaylor 0:eafc3fd41f75 26
bryantaylor 0:eafc3fd41f75 27 #### Generic:
bryantaylor 0:eafc3fd41f75 28
bryantaylor 0:eafc3fd41f75 29 - `TEST_FAIL()`
bryantaylor 0:eafc3fd41f75 30 - `TEST_IGNORE()`
bryantaylor 0:eafc3fd41f75 31 - `TEST_ONLY()`
bryantaylor 0:eafc3fd41f75 32
bryantaylor 0:eafc3fd41f75 33 #### Boolean:
bryantaylor 0:eafc3fd41f75 34
bryantaylor 0:eafc3fd41f75 35 - `TEST_ASSERT(condition)`
bryantaylor 0:eafc3fd41f75 36 - `TEST_ASSERT_TRUE(condition)`
bryantaylor 0:eafc3fd41f75 37 - `TEST_ASSERT_UNLESS(condition)`
bryantaylor 0:eafc3fd41f75 38 - `TEST_ASSERT_FALSE(condition)`
bryantaylor 0:eafc3fd41f75 39
bryantaylor 0:eafc3fd41f75 40 #### Pointer:
bryantaylor 0:eafc3fd41f75 41
bryantaylor 0:eafc3fd41f75 42 - `TEST_ASSERT_NULL(pointer)`
bryantaylor 0:eafc3fd41f75 43 - `TEST_ASSERT_NOT_NULL(pointer)`
bryantaylor 0:eafc3fd41f75 44
bryantaylor 0:eafc3fd41f75 45 #### Equality:
bryantaylor 0:eafc3fd41f75 46
bryantaylor 0:eafc3fd41f75 47 - `TEST_ASSERT_EQUAL(expected, actual)`
bryantaylor 0:eafc3fd41f75 48 - `TEST_ASSERT_NOT_EQUAL(expected, actual)`
bryantaylor 0:eafc3fd41f75 49 - `TEST_ASSERT_EQUAL_INT(expected, actual)`
bryantaylor 0:eafc3fd41f75 50 - `TEST_ASSERT_EQUAL_INT8(expected, actual)`
bryantaylor 0:eafc3fd41f75 51 - `TEST_ASSERT_EQUAL_INT16(expected, actual)`
bryantaylor 0:eafc3fd41f75 52 - `TEST_ASSERT_EQUAL_INT32(expected, actual)`
bryantaylor 0:eafc3fd41f75 53 - `TEST_ASSERT_EQUAL_INT64(expected, actual)`
bryantaylor 0:eafc3fd41f75 54 - `TEST_ASSERT_EQUAL_UINT(expected, actual)`
bryantaylor 0:eafc3fd41f75 55 - `TEST_ASSERT_EQUAL_UINT8(expected, actual)`
bryantaylor 0:eafc3fd41f75 56 - `TEST_ASSERT_EQUAL_UINT16(expected, actual)`
bryantaylor 0:eafc3fd41f75 57 - `TEST_ASSERT_EQUAL_UINT32(expected, actual)`
bryantaylor 0:eafc3fd41f75 58 - `TEST_ASSERT_EQUAL_UINT64(expected, actual)`
bryantaylor 0:eafc3fd41f75 59 - `TEST_ASSERT_EQUAL_HEX(expected, actual)`
bryantaylor 0:eafc3fd41f75 60 - `TEST_ASSERT_EQUAL_HEX8(expected, actual)`
bryantaylor 0:eafc3fd41f75 61 - `TEST_ASSERT_EQUAL_HEX16(expected, actual)`
bryantaylor 0:eafc3fd41f75 62 - `TEST_ASSERT_EQUAL_HEX32(expected, actual)`
bryantaylor 0:eafc3fd41f75 63 - `TEST_ASSERT_EQUAL_HEX64(expected, actual)`
bryantaylor 0:eafc3fd41f75 64
bryantaylor 0:eafc3fd41f75 65 #### Bit Masks:
bryantaylor 0:eafc3fd41f75 66
bryantaylor 0:eafc3fd41f75 67 - `TEST_ASSERT_BITS(mask, expected, actual)`
bryantaylor 0:eafc3fd41f75 68 - `TEST_ASSERT_BITS_HIGH(mask, actual)`
bryantaylor 0:eafc3fd41f75 69 - `TEST_ASSERT_BITS_LOW(mask, actual)`
bryantaylor 0:eafc3fd41f75 70 - `TEST_ASSERT_BIT_HIGH(bit, actual)`
bryantaylor 0:eafc3fd41f75 71 - `TEST_ASSERT_BIT_LOW(bit, actual)`
bryantaylor 0:eafc3fd41f75 72
bryantaylor 0:eafc3fd41f75 73 #### Deltas:
bryantaylor 0:eafc3fd41f75 74
bryantaylor 0:eafc3fd41f75 75 - `TEST_ASSERT_INT_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 76 - `TEST_ASSERT_INT8_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 77 - `TEST_ASSERT_INT16_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 78 - `TEST_ASSERT_INT32_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 79 - `TEST_ASSERT_INT64_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 80 - `TEST_ASSERT_UINT_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 81 - `TEST_ASSERT_UINT8_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 82 - `TEST_ASSERT_UINT16_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 83 - `TEST_ASSERT_UINT32_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 84 - `TEST_ASSERT_UINT64_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 85 - `TEST_ASSERT_HEX_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 86 - `TEST_ASSERT_HEX8_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 87 - `TEST_ASSERT_HEX16_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 88 - `TEST_ASSERT_HEX32_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 89 - `TEST_ASSERT_HEX64_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 90
bryantaylor 0:eafc3fd41f75 91 #### Memory:
bryantaylor 0:eafc3fd41f75 92
bryantaylor 0:eafc3fd41f75 93 - `TEST_ASSERT_EQUAL_PTR(expected, actual)`
bryantaylor 0:eafc3fd41f75 94 - `TEST_ASSERT_EQUAL_STRING(expected, actual)`
bryantaylor 0:eafc3fd41f75 95 - `TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len)`
bryantaylor 0:eafc3fd41f75 96 - `TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)`
bryantaylor 0:eafc3fd41f75 97
bryantaylor 0:eafc3fd41f75 98 #### Array:
bryantaylor 0:eafc3fd41f75 99
bryantaylor 0:eafc3fd41f75 100 - `TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 101 - `TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 102 - `TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 103 - `TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 104 - `TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 105 - `TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 106 - `TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 107 - `TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 108 - `TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 109 - `TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 110 - `TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 111 - `TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 112 - `TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 113 - `TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 114 - `TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 115 - `TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 116 - `TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 117 - `TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements)`
bryantaylor 0:eafc3fd41f75 118
bryantaylor 0:eafc3fd41f75 119 #### Single Precision Floating Point:
bryantaylor 0:eafc3fd41f75 120
bryantaylor 0:eafc3fd41f75 121 - `TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 122 - `TEST_ASSERT_EQUAL_FLOAT(expected, actual)`
bryantaylor 0:eafc3fd41f75 123 - `TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 124 - `TEST_ASSERT_FLOAT_IS_INF(actual)`
bryantaylor 0:eafc3fd41f75 125 - `TEST_ASSERT_FLOAT_IS_NEG_INF(actual)`
bryantaylor 0:eafc3fd41f75 126 - `TEST_ASSERT_FLOAT_IS_NAN(actual)`
bryantaylor 0:eafc3fd41f75 127 - `TEST_ASSERT_FLOAT_IS_DETERMINATE(actual)`
bryantaylor 0:eafc3fd41f75 128 - `TEST_ASSERT_FLOAT_IS_NOT_INF(actual)`
bryantaylor 0:eafc3fd41f75 129 - `TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual)`
bryantaylor 0:eafc3fd41f75 130 - `TEST_ASSERT_FLOAT_IS_NOT_NAN(actual)`
bryantaylor 0:eafc3fd41f75 131 - `TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual)`
bryantaylor 0:eafc3fd41f75 132
bryantaylor 0:eafc3fd41f75 133 #### Double Precision Floating Point:
bryantaylor 0:eafc3fd41f75 134
bryantaylor 0:eafc3fd41f75 135 - `TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual)`
bryantaylor 0:eafc3fd41f75 136 - `TEST_ASSERT_EQUAL_DOUBLE(expected, actual)`
bryantaylor 0:eafc3fd41f75 137 - `TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements)`
bryantaylor 0:eafc3fd41f75 138 - `TEST_ASSERT_DOUBLE_IS_INF(actual)`
bryantaylor 0:eafc3fd41f75 139 - `TEST_ASSERT_DOUBLE_IS_NEG_INF(actual)`
bryantaylor 0:eafc3fd41f75 140 - `TEST_ASSERT_DOUBLE_IS_NAN(actual)`
bryantaylor 0:eafc3fd41f75 141 - `TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual)`
bryantaylor 0:eafc3fd41f75 142 - `TEST_ASSERT_DOUBLE_IS_NOT_INF(actual)`
bryantaylor 0:eafc3fd41f75 143 - `TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual)`
bryantaylor 0:eafc3fd41f75 144 - `TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual)`
bryantaylor 0:eafc3fd41f75 145 - `TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual)`