Preliminary main mbed library for nexpaq development
TESTS/mbed_functional/callback/main.cpp@0:6c56fb4bc5f0, 2016-11-04 (annotated)
- Committer:
- nexpaq
- Date:
- Fri Nov 04 20:27:58 2016 +0000
- Revision:
- 0:6c56fb4bc5f0
Moving to library for sharing updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 0:6c56fb4bc5f0 | 1 | #include "mbed.h" |
nexpaq | 0:6c56fb4bc5f0 | 2 | #include "greentea-client/test_env.h" |
nexpaq | 0:6c56fb4bc5f0 | 3 | #include "unity.h" |
nexpaq | 0:6c56fb4bc5f0 | 4 | #include "utest.h" |
nexpaq | 0:6c56fb4bc5f0 | 5 | |
nexpaq | 0:6c56fb4bc5f0 | 6 | using namespace utest::v1; |
nexpaq | 0:6c56fb4bc5f0 | 7 | |
nexpaq | 0:6c56fb4bc5f0 | 8 | |
nexpaq | 0:6c56fb4bc5f0 | 9 | // static functions |
nexpaq | 0:6c56fb4bc5f0 | 10 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 11 | T static_func0() |
nexpaq | 0:6c56fb4bc5f0 | 12 | { return 0; } |
nexpaq | 0:6c56fb4bc5f0 | 13 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 14 | T static_func1(T a0) |
nexpaq | 0:6c56fb4bc5f0 | 15 | { return 0 | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 16 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 17 | T static_func2(T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 18 | { return 0 | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 19 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 20 | T static_func3(T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 21 | { return 0 | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 22 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 23 | T static_func4(T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 24 | { return 0 | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 25 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 26 | T static_func5(T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 27 | { return 0 | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 28 | |
nexpaq | 0:6c56fb4bc5f0 | 29 | // class functions |
nexpaq | 0:6c56fb4bc5f0 | 30 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 31 | struct Thing { |
nexpaq | 0:6c56fb4bc5f0 | 32 | T t; |
nexpaq | 0:6c56fb4bc5f0 | 33 | Thing() : t(0x80) {} |
nexpaq | 0:6c56fb4bc5f0 | 34 | |
nexpaq | 0:6c56fb4bc5f0 | 35 | T member_func0() |
nexpaq | 0:6c56fb4bc5f0 | 36 | { return t; } |
nexpaq | 0:6c56fb4bc5f0 | 37 | T member_func1(T a0) |
nexpaq | 0:6c56fb4bc5f0 | 38 | { return t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 39 | T member_func2(T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 40 | { return t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 41 | T member_func3(T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 42 | { return t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 43 | T member_func4(T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 44 | { return t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 45 | T member_func5(T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 46 | { return t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 47 | |
nexpaq | 0:6c56fb4bc5f0 | 48 | T const_member_func0() const |
nexpaq | 0:6c56fb4bc5f0 | 49 | { return t; } |
nexpaq | 0:6c56fb4bc5f0 | 50 | T const_member_func1(T a0) const |
nexpaq | 0:6c56fb4bc5f0 | 51 | { return t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 52 | T const_member_func2(T a0, T a1) const |
nexpaq | 0:6c56fb4bc5f0 | 53 | { return t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 54 | T const_member_func3(T a0, T a1, T a2) const |
nexpaq | 0:6c56fb4bc5f0 | 55 | { return t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 56 | T const_member_func4(T a0, T a1, T a2, T a3) const |
nexpaq | 0:6c56fb4bc5f0 | 57 | { return t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 58 | T const_member_func5(T a0, T a1, T a2, T a3, T a4) const |
nexpaq | 0:6c56fb4bc5f0 | 59 | { return t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 60 | |
nexpaq | 0:6c56fb4bc5f0 | 61 | T volatile_member_func0() volatile |
nexpaq | 0:6c56fb4bc5f0 | 62 | { return t; } |
nexpaq | 0:6c56fb4bc5f0 | 63 | T volatile_member_func1(T a0) volatile |
nexpaq | 0:6c56fb4bc5f0 | 64 | { return t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 65 | T volatile_member_func2(T a0, T a1) volatile |
nexpaq | 0:6c56fb4bc5f0 | 66 | { return t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 67 | T volatile_member_func3(T a0, T a1, T a2) volatile |
nexpaq | 0:6c56fb4bc5f0 | 68 | { return t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 69 | T volatile_member_func4(T a0, T a1, T a2, T a3) volatile |
nexpaq | 0:6c56fb4bc5f0 | 70 | { return t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 71 | T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile |
nexpaq | 0:6c56fb4bc5f0 | 72 | { return t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 73 | |
nexpaq | 0:6c56fb4bc5f0 | 74 | T const_volatile_member_func0() const volatile |
nexpaq | 0:6c56fb4bc5f0 | 75 | { return t; } |
nexpaq | 0:6c56fb4bc5f0 | 76 | T const_volatile_member_func1(T a0) const volatile |
nexpaq | 0:6c56fb4bc5f0 | 77 | { return t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 78 | T const_volatile_member_func2(T a0, T a1) const volatile |
nexpaq | 0:6c56fb4bc5f0 | 79 | { return t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 80 | T const_volatile_member_func3(T a0, T a1, T a2) const volatile |
nexpaq | 0:6c56fb4bc5f0 | 81 | { return t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 82 | T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile |
nexpaq | 0:6c56fb4bc5f0 | 83 | { return t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 84 | T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile |
nexpaq | 0:6c56fb4bc5f0 | 85 | { return t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 86 | }; |
nexpaq | 0:6c56fb4bc5f0 | 87 | |
nexpaq | 0:6c56fb4bc5f0 | 88 | // bound functions |
nexpaq | 0:6c56fb4bc5f0 | 89 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 90 | T bound_func0(Thing<T> *t) |
nexpaq | 0:6c56fb4bc5f0 | 91 | { return t->t; } |
nexpaq | 0:6c56fb4bc5f0 | 92 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 93 | T bound_func1(Thing<T> *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 94 | { return t->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 95 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 96 | T bound_func2(Thing<T> *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 97 | { return t->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 98 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 99 | T bound_func3(Thing<T> *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 100 | { return t->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 101 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 102 | T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 103 | { return t->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 104 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 105 | T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 106 | { return t->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 107 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 108 | T const_bound_func0(const Thing<T> *t) |
nexpaq | 0:6c56fb4bc5f0 | 109 | { return t->t; } |
nexpaq | 0:6c56fb4bc5f0 | 110 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 111 | T const_bound_func1(const Thing<T> *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 112 | { return t->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 113 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 114 | T const_bound_func2(const Thing<T> *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 115 | { return t->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 116 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 117 | T const_bound_func3(const Thing<T> *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 118 | { return t->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 119 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 120 | T const_bound_func4(const Thing<T> *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 121 | { return t->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 122 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 123 | T const_bound_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 124 | { return t->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 125 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 126 | T volatile_bound_func0(volatile Thing<T> *t) |
nexpaq | 0:6c56fb4bc5f0 | 127 | { return t->t; } |
nexpaq | 0:6c56fb4bc5f0 | 128 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 129 | T volatile_bound_func1(volatile Thing<T> *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 130 | { return t->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 131 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 132 | T volatile_bound_func2(volatile Thing<T> *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 133 | { return t->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 134 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 135 | T volatile_bound_func3(volatile Thing<T> *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 136 | { return t->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 137 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 138 | T volatile_bound_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 139 | { return t->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 140 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 141 | T volatile_bound_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 142 | { return t->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 143 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 144 | T const_volatile_bound_func0(const volatile Thing<T> *t) |
nexpaq | 0:6c56fb4bc5f0 | 145 | { return t->t; } |
nexpaq | 0:6c56fb4bc5f0 | 146 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 147 | T const_volatile_bound_func1(const volatile Thing<T> *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 148 | { return t->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 149 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 150 | T const_volatile_bound_func2(const volatile Thing<T> *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 151 | { return t->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 152 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 153 | T const_volatile_bound_func3(const volatile Thing<T> *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 154 | { return t->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 155 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 156 | T const_volatile_bound_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 157 | { return t->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 158 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 159 | T const_volatile_bound_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 160 | { return t->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 161 | |
nexpaq | 0:6c56fb4bc5f0 | 162 | // void functions |
nexpaq | 0:6c56fb4bc5f0 | 163 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 164 | T void_func0(void *t) |
nexpaq | 0:6c56fb4bc5f0 | 165 | { return static_cast<Thing<T>*>(t)->t; } |
nexpaq | 0:6c56fb4bc5f0 | 166 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 167 | T void_func1(void *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 168 | { return static_cast<Thing<T>*>(t)->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 169 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 170 | T void_func2(void *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 171 | { return static_cast<Thing<T>*>(t)->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 172 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 173 | T void_func3(void *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 174 | { return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 175 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 176 | T void_func4(void *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 177 | { return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 178 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 179 | T void_func5(void *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 180 | { return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 181 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 182 | T const_void_func0(const void *t) |
nexpaq | 0:6c56fb4bc5f0 | 183 | { return static_cast<const Thing<T>*>(t)->t; } |
nexpaq | 0:6c56fb4bc5f0 | 184 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 185 | T const_void_func1(const void *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 186 | { return static_cast<const Thing<T>*>(t)->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 187 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 188 | T const_void_func2(const void *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 189 | { return static_cast<const Thing<T>*>(t)->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 190 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 191 | T const_void_func3(const void *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 192 | { return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 193 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 194 | T const_void_func4(const void *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 195 | { return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 196 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 197 | T const_void_func5(const void *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 198 | { return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 199 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 200 | T volatile_void_func0(volatile void *t) |
nexpaq | 0:6c56fb4bc5f0 | 201 | { return static_cast<volatile Thing<T>*>(t)->t; } |
nexpaq | 0:6c56fb4bc5f0 | 202 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 203 | T volatile_void_func1(volatile void *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 204 | { return static_cast<volatile Thing<T>*>(t)->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 205 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 206 | T volatile_void_func2(volatile void *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 207 | { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 208 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 209 | T volatile_void_func3(volatile void *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 210 | { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 211 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 212 | T volatile_void_func4(volatile void *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 213 | { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 214 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 215 | T volatile_void_func5(volatile void *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 216 | { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 217 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 218 | T const_volatile_void_func0(const volatile void *t) |
nexpaq | 0:6c56fb4bc5f0 | 219 | { return static_cast<const volatile Thing<T>*>(t)->t; } |
nexpaq | 0:6c56fb4bc5f0 | 220 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 221 | T const_volatile_void_func1(const volatile void *t, T a0) |
nexpaq | 0:6c56fb4bc5f0 | 222 | { return static_cast<const volatile Thing<T>*>(t)->t | a0; } |
nexpaq | 0:6c56fb4bc5f0 | 223 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 224 | T const_volatile_void_func2(const volatile void *t, T a0, T a1) |
nexpaq | 0:6c56fb4bc5f0 | 225 | { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1; } |
nexpaq | 0:6c56fb4bc5f0 | 226 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 227 | T const_volatile_void_func3(const volatile void *t, T a0, T a1, T a2) |
nexpaq | 0:6c56fb4bc5f0 | 228 | { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2; } |
nexpaq | 0:6c56fb4bc5f0 | 229 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 230 | T const_volatile_void_func4(const volatile void *t, T a0, T a1, T a2, T a3) |
nexpaq | 0:6c56fb4bc5f0 | 231 | { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; } |
nexpaq | 0:6c56fb4bc5f0 | 232 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 233 | T const_volatile_void_func5(const volatile void *t, T a0, T a1, T a2, T a3, T a4) |
nexpaq | 0:6c56fb4bc5f0 | 234 | { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; } |
nexpaq | 0:6c56fb4bc5f0 | 235 | |
nexpaq | 0:6c56fb4bc5f0 | 236 | |
nexpaq | 0:6c56fb4bc5f0 | 237 | // function call and result verification |
nexpaq | 0:6c56fb4bc5f0 | 238 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 239 | struct Verifier { |
nexpaq | 0:6c56fb4bc5f0 | 240 | static void verify0(Callback<T()> func) { |
nexpaq | 0:6c56fb4bc5f0 | 241 | T result = func(); |
nexpaq | 0:6c56fb4bc5f0 | 242 | TEST_ASSERT_EQUAL(result, 0x00); |
nexpaq | 0:6c56fb4bc5f0 | 243 | } |
nexpaq | 0:6c56fb4bc5f0 | 244 | |
nexpaq | 0:6c56fb4bc5f0 | 245 | template <typename O, typename M> |
nexpaq | 0:6c56fb4bc5f0 | 246 | static void verify0(O *obj, M method) { |
nexpaq | 0:6c56fb4bc5f0 | 247 | Callback<T()> func(obj, method); |
nexpaq | 0:6c56fb4bc5f0 | 248 | T result = func(); |
nexpaq | 0:6c56fb4bc5f0 | 249 | TEST_ASSERT_EQUAL(result, 0x80); |
nexpaq | 0:6c56fb4bc5f0 | 250 | } |
nexpaq | 0:6c56fb4bc5f0 | 251 | |
nexpaq | 0:6c56fb4bc5f0 | 252 | static void verify1(Callback<T(T)> func) { |
nexpaq | 0:6c56fb4bc5f0 | 253 | T result = func((1 << 0)); |
nexpaq | 0:6c56fb4bc5f0 | 254 | TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0)); |
nexpaq | 0:6c56fb4bc5f0 | 255 | } |
nexpaq | 0:6c56fb4bc5f0 | 256 | |
nexpaq | 0:6c56fb4bc5f0 | 257 | template <typename O, typename M> |
nexpaq | 0:6c56fb4bc5f0 | 258 | static void verify1(O *obj, M method) { |
nexpaq | 0:6c56fb4bc5f0 | 259 | Callback<T(T)> func(obj, method); |
nexpaq | 0:6c56fb4bc5f0 | 260 | T result = func((1 << 0)); |
nexpaq | 0:6c56fb4bc5f0 | 261 | TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0)); |
nexpaq | 0:6c56fb4bc5f0 | 262 | } |
nexpaq | 0:6c56fb4bc5f0 | 263 | |
nexpaq | 0:6c56fb4bc5f0 | 264 | static void verify2(Callback<T(T, T)> func) { |
nexpaq | 0:6c56fb4bc5f0 | 265 | T result = func((1 << 0), (1 << 1)); |
nexpaq | 0:6c56fb4bc5f0 | 266 | TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1)); |
nexpaq | 0:6c56fb4bc5f0 | 267 | } |
nexpaq | 0:6c56fb4bc5f0 | 268 | |
nexpaq | 0:6c56fb4bc5f0 | 269 | template <typename O, typename M> |
nexpaq | 0:6c56fb4bc5f0 | 270 | static void verify2(O *obj, M method) { |
nexpaq | 0:6c56fb4bc5f0 | 271 | Callback<T(T, T)> func(obj, method); |
nexpaq | 0:6c56fb4bc5f0 | 272 | T result = func((1 << 0), (1 << 1)); |
nexpaq | 0:6c56fb4bc5f0 | 273 | TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1)); |
nexpaq | 0:6c56fb4bc5f0 | 274 | } |
nexpaq | 0:6c56fb4bc5f0 | 275 | |
nexpaq | 0:6c56fb4bc5f0 | 276 | static void verify3(Callback<T(T, T, T)> func) { |
nexpaq | 0:6c56fb4bc5f0 | 277 | T result = func((1 << 0), (1 << 1), (1 << 2)); |
nexpaq | 0:6c56fb4bc5f0 | 278 | TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2)); |
nexpaq | 0:6c56fb4bc5f0 | 279 | } |
nexpaq | 0:6c56fb4bc5f0 | 280 | |
nexpaq | 0:6c56fb4bc5f0 | 281 | template <typename O, typename M> |
nexpaq | 0:6c56fb4bc5f0 | 282 | static void verify3(O *obj, M method) { |
nexpaq | 0:6c56fb4bc5f0 | 283 | Callback<T(T, T, T)> func(obj, method); |
nexpaq | 0:6c56fb4bc5f0 | 284 | T result = func((1 << 0), (1 << 1), (1 << 2)); |
nexpaq | 0:6c56fb4bc5f0 | 285 | TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2)); |
nexpaq | 0:6c56fb4bc5f0 | 286 | } |
nexpaq | 0:6c56fb4bc5f0 | 287 | |
nexpaq | 0:6c56fb4bc5f0 | 288 | static void verify4(Callback<T(T, T, T, T)> func) { |
nexpaq | 0:6c56fb4bc5f0 | 289 | T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3)); |
nexpaq | 0:6c56fb4bc5f0 | 290 | TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)); |
nexpaq | 0:6c56fb4bc5f0 | 291 | } |
nexpaq | 0:6c56fb4bc5f0 | 292 | |
nexpaq | 0:6c56fb4bc5f0 | 293 | template <typename O, typename M> |
nexpaq | 0:6c56fb4bc5f0 | 294 | static void verify4(O *obj, M method) { |
nexpaq | 0:6c56fb4bc5f0 | 295 | Callback<T(T, T, T, T)> func(obj, method); |
nexpaq | 0:6c56fb4bc5f0 | 296 | T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3)); |
nexpaq | 0:6c56fb4bc5f0 | 297 | TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)); |
nexpaq | 0:6c56fb4bc5f0 | 298 | } |
nexpaq | 0:6c56fb4bc5f0 | 299 | |
nexpaq | 0:6c56fb4bc5f0 | 300 | static void verify5(Callback<T(T, T, T, T, T)> func) { |
nexpaq | 0:6c56fb4bc5f0 | 301 | T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4)); |
nexpaq | 0:6c56fb4bc5f0 | 302 | TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4)); |
nexpaq | 0:6c56fb4bc5f0 | 303 | } |
nexpaq | 0:6c56fb4bc5f0 | 304 | |
nexpaq | 0:6c56fb4bc5f0 | 305 | template <typename O, typename M> |
nexpaq | 0:6c56fb4bc5f0 | 306 | static void verify5(O *obj, M method) { |
nexpaq | 0:6c56fb4bc5f0 | 307 | Callback<T(T, T, T, T, T)> func(obj, method); |
nexpaq | 0:6c56fb4bc5f0 | 308 | T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4)); |
nexpaq | 0:6c56fb4bc5f0 | 309 | TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4)); |
nexpaq | 0:6c56fb4bc5f0 | 310 | } |
nexpaq | 0:6c56fb4bc5f0 | 311 | }; |
nexpaq | 0:6c56fb4bc5f0 | 312 | |
nexpaq | 0:6c56fb4bc5f0 | 313 | |
nexpaq | 0:6c56fb4bc5f0 | 314 | // test dispatch |
nexpaq | 0:6c56fb4bc5f0 | 315 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 316 | void test_dispatch0() { |
nexpaq | 0:6c56fb4bc5f0 | 317 | Thing<T> thing; |
nexpaq | 0:6c56fb4bc5f0 | 318 | Verifier<T>::verify0(static_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 319 | Verifier<T>::verify0(&thing, &Thing<T>::member_func0); |
nexpaq | 0:6c56fb4bc5f0 | 320 | Verifier<T>::verify0((const Thing<T>*)&thing, &Thing<T>::const_member_func0); |
nexpaq | 0:6c56fb4bc5f0 | 321 | Verifier<T>::verify0((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func0); |
nexpaq | 0:6c56fb4bc5f0 | 322 | Verifier<T>::verify0((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func0); |
nexpaq | 0:6c56fb4bc5f0 | 323 | Verifier<T>::verify0(&thing, &bound_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 324 | Verifier<T>::verify0((const Thing<T>*)&thing, &const_bound_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 325 | Verifier<T>::verify0((volatile Thing<T>*)&thing, &volatile_bound_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 326 | Verifier<T>::verify0((const volatile Thing<T>*)&thing, &const_volatile_bound_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 327 | Verifier<T>::verify0(&thing, &void_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 328 | Verifier<T>::verify0((const Thing<T>*)&thing, &const_void_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 329 | Verifier<T>::verify0((volatile Thing<T>*)&thing, &volatile_void_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 330 | Verifier<T>::verify0((const volatile Thing<T>*)&thing, &const_volatile_void_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 331 | Verifier<T>::verify0(callback(static_func0<T>)); |
nexpaq | 0:6c56fb4bc5f0 | 332 | |
nexpaq | 0:6c56fb4bc5f0 | 333 | Callback<T()> cb(static_func0); |
nexpaq | 0:6c56fb4bc5f0 | 334 | Verifier<T>::verify0(cb); |
nexpaq | 0:6c56fb4bc5f0 | 335 | cb = static_func0; |
nexpaq | 0:6c56fb4bc5f0 | 336 | Verifier<T>::verify0(cb); |
nexpaq | 0:6c56fb4bc5f0 | 337 | cb.attach(&thing, &bound_func0<T>); |
nexpaq | 0:6c56fb4bc5f0 | 338 | Verifier<T>::verify0(&cb, &Callback<T()>::call); |
nexpaq | 0:6c56fb4bc5f0 | 339 | Verifier<T>::verify0((void*)&cb, &Callback<T()>::thunk); |
nexpaq | 0:6c56fb4bc5f0 | 340 | } |
nexpaq | 0:6c56fb4bc5f0 | 341 | |
nexpaq | 0:6c56fb4bc5f0 | 342 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 343 | void test_dispatch1() { |
nexpaq | 0:6c56fb4bc5f0 | 344 | Thing<T> thing; |
nexpaq | 0:6c56fb4bc5f0 | 345 | Verifier<T>::verify1(static_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 346 | Verifier<T>::verify1(&thing, &Thing<T>::member_func1); |
nexpaq | 0:6c56fb4bc5f0 | 347 | Verifier<T>::verify1((const Thing<T>*)&thing, &Thing<T>::const_member_func1); |
nexpaq | 0:6c56fb4bc5f0 | 348 | Verifier<T>::verify1((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func1); |
nexpaq | 0:6c56fb4bc5f0 | 349 | Verifier<T>::verify1((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func1); |
nexpaq | 0:6c56fb4bc5f0 | 350 | Verifier<T>::verify1(&thing, &bound_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 351 | Verifier<T>::verify1((const Thing<T>*)&thing, &const_bound_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 352 | Verifier<T>::verify1((volatile Thing<T>*)&thing, &volatile_bound_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 353 | Verifier<T>::verify1((const volatile Thing<T>*)&thing, &const_volatile_bound_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 354 | Verifier<T>::verify1(&thing, &void_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 355 | Verifier<T>::verify1((const Thing<T>*)&thing, &const_void_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 356 | Verifier<T>::verify1((volatile Thing<T>*)&thing, &volatile_void_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 357 | Verifier<T>::verify1((const volatile Thing<T>*)&thing, &const_volatile_void_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 358 | Verifier<T>::verify1(callback(static_func1<T>)); |
nexpaq | 0:6c56fb4bc5f0 | 359 | |
nexpaq | 0:6c56fb4bc5f0 | 360 | Callback<T(T)> cb(static_func1); |
nexpaq | 0:6c56fb4bc5f0 | 361 | Verifier<T>::verify1(cb); |
nexpaq | 0:6c56fb4bc5f0 | 362 | cb = static_func1; |
nexpaq | 0:6c56fb4bc5f0 | 363 | Verifier<T>::verify1(cb); |
nexpaq | 0:6c56fb4bc5f0 | 364 | cb.attach(&thing, &bound_func1<T>); |
nexpaq | 0:6c56fb4bc5f0 | 365 | Verifier<T>::verify1(&cb, &Callback<T(T)>::call); |
nexpaq | 0:6c56fb4bc5f0 | 366 | Verifier<T>::verify1((void*)&cb, &Callback<T(T)>::thunk); |
nexpaq | 0:6c56fb4bc5f0 | 367 | } |
nexpaq | 0:6c56fb4bc5f0 | 368 | |
nexpaq | 0:6c56fb4bc5f0 | 369 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 370 | void test_dispatch2() { |
nexpaq | 0:6c56fb4bc5f0 | 371 | Thing<T> thing; |
nexpaq | 0:6c56fb4bc5f0 | 372 | Verifier<T>::verify2(static_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 373 | Verifier<T>::verify2(&thing, &Thing<T>::member_func2); |
nexpaq | 0:6c56fb4bc5f0 | 374 | Verifier<T>::verify2((const Thing<T>*)&thing, &Thing<T>::const_member_func2); |
nexpaq | 0:6c56fb4bc5f0 | 375 | Verifier<T>::verify2((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func2); |
nexpaq | 0:6c56fb4bc5f0 | 376 | Verifier<T>::verify2((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func2); |
nexpaq | 0:6c56fb4bc5f0 | 377 | Verifier<T>::verify2(&thing, &bound_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 378 | Verifier<T>::verify2((const Thing<T>*)&thing, &const_bound_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 379 | Verifier<T>::verify2((volatile Thing<T>*)&thing, &volatile_bound_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 380 | Verifier<T>::verify2((const volatile Thing<T>*)&thing, &const_volatile_bound_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 381 | Verifier<T>::verify2(&thing, &void_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 382 | Verifier<T>::verify2((const Thing<T>*)&thing, &const_void_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 383 | Verifier<T>::verify2((volatile Thing<T>*)&thing, &volatile_void_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 384 | Verifier<T>::verify2((const volatile Thing<T>*)&thing, &const_volatile_void_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 385 | Verifier<T>::verify2(callback(static_func2<T>)); |
nexpaq | 0:6c56fb4bc5f0 | 386 | |
nexpaq | 0:6c56fb4bc5f0 | 387 | Callback<T(T, T)> cb(static_func2); |
nexpaq | 0:6c56fb4bc5f0 | 388 | Verifier<T>::verify2(cb); |
nexpaq | 0:6c56fb4bc5f0 | 389 | cb = static_func2; |
nexpaq | 0:6c56fb4bc5f0 | 390 | Verifier<T>::verify2(cb); |
nexpaq | 0:6c56fb4bc5f0 | 391 | cb.attach(&thing, &bound_func2<T>); |
nexpaq | 0:6c56fb4bc5f0 | 392 | Verifier<T>::verify2(&cb, &Callback<T(T, T)>::call); |
nexpaq | 0:6c56fb4bc5f0 | 393 | Verifier<T>::verify2((void*)&cb, &Callback<T(T, T)>::thunk); |
nexpaq | 0:6c56fb4bc5f0 | 394 | } |
nexpaq | 0:6c56fb4bc5f0 | 395 | |
nexpaq | 0:6c56fb4bc5f0 | 396 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 397 | void test_dispatch3() { |
nexpaq | 0:6c56fb4bc5f0 | 398 | Thing<T> thing; |
nexpaq | 0:6c56fb4bc5f0 | 399 | Verifier<T>::verify3(static_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 400 | Verifier<T>::verify3(&thing, &Thing<T>::member_func3); |
nexpaq | 0:6c56fb4bc5f0 | 401 | Verifier<T>::verify3((const Thing<T>*)&thing, &Thing<T>::const_member_func3); |
nexpaq | 0:6c56fb4bc5f0 | 402 | Verifier<T>::verify3((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func3); |
nexpaq | 0:6c56fb4bc5f0 | 403 | Verifier<T>::verify3((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func3); |
nexpaq | 0:6c56fb4bc5f0 | 404 | Verifier<T>::verify3(&thing, &bound_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 405 | Verifier<T>::verify3((const Thing<T>*)&thing, &const_bound_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 406 | Verifier<T>::verify3((volatile Thing<T>*)&thing, &volatile_bound_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 407 | Verifier<T>::verify3((const volatile Thing<T>*)&thing, &const_volatile_bound_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 408 | Verifier<T>::verify3(&thing, &void_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 409 | Verifier<T>::verify3((const Thing<T>*)&thing, &const_void_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 410 | Verifier<T>::verify3((volatile Thing<T>*)&thing, &volatile_void_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 411 | Verifier<T>::verify3((const volatile Thing<T>*)&thing, &const_volatile_void_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 412 | Verifier<T>::verify3(callback(static_func3<T>)); |
nexpaq | 0:6c56fb4bc5f0 | 413 | |
nexpaq | 0:6c56fb4bc5f0 | 414 | Callback<T(T, T, T)> cb(static_func3); |
nexpaq | 0:6c56fb4bc5f0 | 415 | Verifier<T>::verify3(cb); |
nexpaq | 0:6c56fb4bc5f0 | 416 | cb = static_func3; |
nexpaq | 0:6c56fb4bc5f0 | 417 | Verifier<T>::verify3(cb); |
nexpaq | 0:6c56fb4bc5f0 | 418 | cb.attach(&thing, &bound_func3<T>); |
nexpaq | 0:6c56fb4bc5f0 | 419 | Verifier<T>::verify3(&cb, &Callback<T(T, T, T)>::call); |
nexpaq | 0:6c56fb4bc5f0 | 420 | Verifier<T>::verify3((void*)&cb, &Callback<T(T, T, T)>::thunk); |
nexpaq | 0:6c56fb4bc5f0 | 421 | } |
nexpaq | 0:6c56fb4bc5f0 | 422 | |
nexpaq | 0:6c56fb4bc5f0 | 423 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 424 | void test_dispatch4() { |
nexpaq | 0:6c56fb4bc5f0 | 425 | Thing<T> thing; |
nexpaq | 0:6c56fb4bc5f0 | 426 | Verifier<T>::verify4(static_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 427 | Verifier<T>::verify4(&thing, &Thing<T>::member_func4); |
nexpaq | 0:6c56fb4bc5f0 | 428 | Verifier<T>::verify4((const Thing<T>*)&thing, &Thing<T>::const_member_func4); |
nexpaq | 0:6c56fb4bc5f0 | 429 | Verifier<T>::verify4((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func4); |
nexpaq | 0:6c56fb4bc5f0 | 430 | Verifier<T>::verify4((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func4); |
nexpaq | 0:6c56fb4bc5f0 | 431 | Verifier<T>::verify4(&thing, &bound_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 432 | Verifier<T>::verify4((const Thing<T>*)&thing, &const_bound_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 433 | Verifier<T>::verify4((volatile Thing<T>*)&thing, &volatile_bound_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 434 | Verifier<T>::verify4((const volatile Thing<T>*)&thing, &const_volatile_bound_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 435 | Verifier<T>::verify4(&thing, &void_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 436 | Verifier<T>::verify4((const Thing<T>*)&thing, &const_void_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 437 | Verifier<T>::verify4((volatile Thing<T>*)&thing, &volatile_void_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 438 | Verifier<T>::verify4((const volatile Thing<T>*)&thing, &const_volatile_void_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 439 | Verifier<T>::verify4(callback(static_func4<T>)); |
nexpaq | 0:6c56fb4bc5f0 | 440 | |
nexpaq | 0:6c56fb4bc5f0 | 441 | Callback<T(T, T, T, T)> cb(static_func4); |
nexpaq | 0:6c56fb4bc5f0 | 442 | Verifier<T>::verify4(cb); |
nexpaq | 0:6c56fb4bc5f0 | 443 | cb = static_func4; |
nexpaq | 0:6c56fb4bc5f0 | 444 | Verifier<T>::verify4(cb); |
nexpaq | 0:6c56fb4bc5f0 | 445 | cb.attach(&thing, &bound_func4<T>); |
nexpaq | 0:6c56fb4bc5f0 | 446 | Verifier<T>::verify4(&cb, &Callback<T(T, T, T, T)>::call); |
nexpaq | 0:6c56fb4bc5f0 | 447 | Verifier<T>::verify4((void*)&cb, &Callback<T(T, T, T, T)>::thunk); |
nexpaq | 0:6c56fb4bc5f0 | 448 | } |
nexpaq | 0:6c56fb4bc5f0 | 449 | |
nexpaq | 0:6c56fb4bc5f0 | 450 | template <typename T> |
nexpaq | 0:6c56fb4bc5f0 | 451 | void test_dispatch5() { |
nexpaq | 0:6c56fb4bc5f0 | 452 | Thing<T> thing; |
nexpaq | 0:6c56fb4bc5f0 | 453 | Verifier<T>::verify5(static_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 454 | Verifier<T>::verify5(&thing, &Thing<T>::member_func5); |
nexpaq | 0:6c56fb4bc5f0 | 455 | Verifier<T>::verify5((const Thing<T>*)&thing, &Thing<T>::const_member_func5); |
nexpaq | 0:6c56fb4bc5f0 | 456 | Verifier<T>::verify5((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func5); |
nexpaq | 0:6c56fb4bc5f0 | 457 | Verifier<T>::verify5((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func5); |
nexpaq | 0:6c56fb4bc5f0 | 458 | Verifier<T>::verify5(&thing, &bound_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 459 | Verifier<T>::verify5((const Thing<T>*)&thing, &const_bound_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 460 | Verifier<T>::verify5((volatile Thing<T>*)&thing, &volatile_bound_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 461 | Verifier<T>::verify5((const volatile Thing<T>*)&thing, &const_volatile_bound_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 462 | Verifier<T>::verify5(&thing, &void_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 463 | Verifier<T>::verify5((const Thing<T>*)&thing, &const_void_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 464 | Verifier<T>::verify5((volatile Thing<T>*)&thing, &volatile_void_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 465 | Verifier<T>::verify5((const volatile Thing<T>*)&thing, &const_volatile_void_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 466 | Verifier<T>::verify5(callback(static_func5<T>)); |
nexpaq | 0:6c56fb4bc5f0 | 467 | |
nexpaq | 0:6c56fb4bc5f0 | 468 | Callback<T(T, T, T, T, T)> cb(static_func5); |
nexpaq | 0:6c56fb4bc5f0 | 469 | Verifier<T>::verify5(cb); |
nexpaq | 0:6c56fb4bc5f0 | 470 | cb = static_func5; |
nexpaq | 0:6c56fb4bc5f0 | 471 | Verifier<T>::verify5(cb); |
nexpaq | 0:6c56fb4bc5f0 | 472 | cb.attach(&thing, &bound_func5<T>); |
nexpaq | 0:6c56fb4bc5f0 | 473 | Verifier<T>::verify5(&cb, &Callback<T(T, T, T, T, T)>::call); |
nexpaq | 0:6c56fb4bc5f0 | 474 | Verifier<T>::verify5((void*)&cb, &Callback<T(T, T, T, T, T)>::thunk); |
nexpaq | 0:6c56fb4bc5f0 | 475 | } |
nexpaq | 0:6c56fb4bc5f0 | 476 | |
nexpaq | 0:6c56fb4bc5f0 | 477 | |
nexpaq | 0:6c56fb4bc5f0 | 478 | // Test setup |
nexpaq | 0:6c56fb4bc5f0 | 479 | utest::v1::status_t test_setup(const size_t number_of_cases) { |
nexpaq | 0:6c56fb4bc5f0 | 480 | GREENTEA_SETUP(10, "default_auto"); |
nexpaq | 0:6c56fb4bc5f0 | 481 | return verbose_test_setup_handler(number_of_cases); |
nexpaq | 0:6c56fb4bc5f0 | 482 | } |
nexpaq | 0:6c56fb4bc5f0 | 483 | |
nexpaq | 0:6c56fb4bc5f0 | 484 | Case cases[] = { |
nexpaq | 0:6c56fb4bc5f0 | 485 | Case("Testing callbacks with 0 ints", test_dispatch0<int>), |
nexpaq | 0:6c56fb4bc5f0 | 486 | Case("Testing callbacks with 1 ints", test_dispatch1<int>), |
nexpaq | 0:6c56fb4bc5f0 | 487 | Case("Testing callbacks with 2 ints", test_dispatch2<int>), |
nexpaq | 0:6c56fb4bc5f0 | 488 | Case("Testing callbacks with 3 ints", test_dispatch3<int>), |
nexpaq | 0:6c56fb4bc5f0 | 489 | Case("Testing callbacks with 4 ints", test_dispatch4<int>), |
nexpaq | 0:6c56fb4bc5f0 | 490 | Case("Testing callbacks with 5 ints", test_dispatch5<int>), |
nexpaq | 0:6c56fb4bc5f0 | 491 | }; |
nexpaq | 0:6c56fb4bc5f0 | 492 | |
nexpaq | 0:6c56fb4bc5f0 | 493 | Specification specification(test_setup, cases); |
nexpaq | 0:6c56fb4bc5f0 | 494 | |
nexpaq | 0:6c56fb4bc5f0 | 495 | int main() { |
nexpaq | 0:6c56fb4bc5f0 | 496 | return !Harness::run(specification); |
nexpaq | 0:6c56fb4bc5f0 | 497 | } |