Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466

Dependencies:   ssd1331

Committer:
kadonotakashi
Date:
Wed Oct 10 00:33:53 2018 +0000
Revision:
0:8fdf9a60065b
how to make mbed librry

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kadonotakashi 0:8fdf9a60065b 1 /* mbed Microcontroller Library
kadonotakashi 0:8fdf9a60065b 2 * Copyright (c) 2017 ARM Limited
kadonotakashi 0:8fdf9a60065b 3 *
kadonotakashi 0:8fdf9a60065b 4 * Licensed under the Apache License, Version 2.0 (the "License");
kadonotakashi 0:8fdf9a60065b 5 * you may not use this file except in compliance with the License.
kadonotakashi 0:8fdf9a60065b 6 * You may obtain a copy of the License at
kadonotakashi 0:8fdf9a60065b 7 *
kadonotakashi 0:8fdf9a60065b 8 * http://www.apache.org/licenses/LICENSE-2.0
kadonotakashi 0:8fdf9a60065b 9 *
kadonotakashi 0:8fdf9a60065b 10 * Unless required by applicable law or agreed to in writing, software
kadonotakashi 0:8fdf9a60065b 11 * distributed under the License is distributed on an "AS IS" BASIS,
kadonotakashi 0:8fdf9a60065b 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
kadonotakashi 0:8fdf9a60065b 13 * See the License for the specific language governing permissions and
kadonotakashi 0:8fdf9a60065b 14 * limitations under the License.
kadonotakashi 0:8fdf9a60065b 15 */
kadonotakashi 0:8fdf9a60065b 16 #include "mbed.h"
kadonotakashi 0:8fdf9a60065b 17 #include "greentea-client/test_env.h"
kadonotakashi 0:8fdf9a60065b 18 #include "unity.h"
kadonotakashi 0:8fdf9a60065b 19 #include "utest.h"
kadonotakashi 0:8fdf9a60065b 20
kadonotakashi 0:8fdf9a60065b 21 using namespace utest::v1;
kadonotakashi 0:8fdf9a60065b 22
kadonotakashi 0:8fdf9a60065b 23
kadonotakashi 0:8fdf9a60065b 24 // static functions
kadonotakashi 0:8fdf9a60065b 25 template <typename T>
kadonotakashi 0:8fdf9a60065b 26 T static_func0()
kadonotakashi 0:8fdf9a60065b 27 {
kadonotakashi 0:8fdf9a60065b 28 return 0;
kadonotakashi 0:8fdf9a60065b 29 }
kadonotakashi 0:8fdf9a60065b 30 template <typename T>
kadonotakashi 0:8fdf9a60065b 31 T static_func1(T a0)
kadonotakashi 0:8fdf9a60065b 32 {
kadonotakashi 0:8fdf9a60065b 33 return 0 | a0;
kadonotakashi 0:8fdf9a60065b 34 }
kadonotakashi 0:8fdf9a60065b 35 template <typename T>
kadonotakashi 0:8fdf9a60065b 36 T static_func2(T a0, T a1)
kadonotakashi 0:8fdf9a60065b 37 {
kadonotakashi 0:8fdf9a60065b 38 return 0 | a0 | a1;
kadonotakashi 0:8fdf9a60065b 39 }
kadonotakashi 0:8fdf9a60065b 40 template <typename T>
kadonotakashi 0:8fdf9a60065b 41 T static_func3(T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 42 {
kadonotakashi 0:8fdf9a60065b 43 return 0 | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 44 }
kadonotakashi 0:8fdf9a60065b 45 template <typename T>
kadonotakashi 0:8fdf9a60065b 46 T static_func4(T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 47 {
kadonotakashi 0:8fdf9a60065b 48 return 0 | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 49 }
kadonotakashi 0:8fdf9a60065b 50 template <typename T>
kadonotakashi 0:8fdf9a60065b 51 T static_func5(T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 52 {
kadonotakashi 0:8fdf9a60065b 53 return 0 | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 54 }
kadonotakashi 0:8fdf9a60065b 55
kadonotakashi 0:8fdf9a60065b 56 // class functions
kadonotakashi 0:8fdf9a60065b 57 template <typename T>
kadonotakashi 0:8fdf9a60065b 58 struct Thing {
kadonotakashi 0:8fdf9a60065b 59 T t;
kadonotakashi 0:8fdf9a60065b 60 Thing() : t(0x80) {}
kadonotakashi 0:8fdf9a60065b 61
kadonotakashi 0:8fdf9a60065b 62 T member_func0()
kadonotakashi 0:8fdf9a60065b 63 {
kadonotakashi 0:8fdf9a60065b 64 return t;
kadonotakashi 0:8fdf9a60065b 65 }
kadonotakashi 0:8fdf9a60065b 66 T member_func1(T a0)
kadonotakashi 0:8fdf9a60065b 67 {
kadonotakashi 0:8fdf9a60065b 68 return t | a0;
kadonotakashi 0:8fdf9a60065b 69 }
kadonotakashi 0:8fdf9a60065b 70 T member_func2(T a0, T a1)
kadonotakashi 0:8fdf9a60065b 71 {
kadonotakashi 0:8fdf9a60065b 72 return t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 73 }
kadonotakashi 0:8fdf9a60065b 74 T member_func3(T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 75 {
kadonotakashi 0:8fdf9a60065b 76 return t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 77 }
kadonotakashi 0:8fdf9a60065b 78 T member_func4(T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 79 {
kadonotakashi 0:8fdf9a60065b 80 return t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 81 }
kadonotakashi 0:8fdf9a60065b 82 T member_func5(T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 83 {
kadonotakashi 0:8fdf9a60065b 84 return t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 85 }
kadonotakashi 0:8fdf9a60065b 86
kadonotakashi 0:8fdf9a60065b 87 T const_member_func0() const
kadonotakashi 0:8fdf9a60065b 88 {
kadonotakashi 0:8fdf9a60065b 89 return t;
kadonotakashi 0:8fdf9a60065b 90 }
kadonotakashi 0:8fdf9a60065b 91 T const_member_func1(T a0) const
kadonotakashi 0:8fdf9a60065b 92 {
kadonotakashi 0:8fdf9a60065b 93 return t | a0;
kadonotakashi 0:8fdf9a60065b 94 }
kadonotakashi 0:8fdf9a60065b 95 T const_member_func2(T a0, T a1) const
kadonotakashi 0:8fdf9a60065b 96 {
kadonotakashi 0:8fdf9a60065b 97 return t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 98 }
kadonotakashi 0:8fdf9a60065b 99 T const_member_func3(T a0, T a1, T a2) const
kadonotakashi 0:8fdf9a60065b 100 {
kadonotakashi 0:8fdf9a60065b 101 return t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 102 }
kadonotakashi 0:8fdf9a60065b 103 T const_member_func4(T a0, T a1, T a2, T a3) const
kadonotakashi 0:8fdf9a60065b 104 {
kadonotakashi 0:8fdf9a60065b 105 return t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 106 }
kadonotakashi 0:8fdf9a60065b 107 T const_member_func5(T a0, T a1, T a2, T a3, T a4) const
kadonotakashi 0:8fdf9a60065b 108 {
kadonotakashi 0:8fdf9a60065b 109 return t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 110 }
kadonotakashi 0:8fdf9a60065b 111
kadonotakashi 0:8fdf9a60065b 112 T volatile_member_func0() volatile
kadonotakashi 0:8fdf9a60065b 113 {
kadonotakashi 0:8fdf9a60065b 114 return t;
kadonotakashi 0:8fdf9a60065b 115 }
kadonotakashi 0:8fdf9a60065b 116 T volatile_member_func1(T a0) volatile
kadonotakashi 0:8fdf9a60065b 117 {
kadonotakashi 0:8fdf9a60065b 118 return t | a0;
kadonotakashi 0:8fdf9a60065b 119 }
kadonotakashi 0:8fdf9a60065b 120 T volatile_member_func2(T a0, T a1) volatile
kadonotakashi 0:8fdf9a60065b 121 {
kadonotakashi 0:8fdf9a60065b 122 return t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 123 }
kadonotakashi 0:8fdf9a60065b 124 T volatile_member_func3(T a0, T a1, T a2) volatile
kadonotakashi 0:8fdf9a60065b 125 {
kadonotakashi 0:8fdf9a60065b 126 return t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 127 }
kadonotakashi 0:8fdf9a60065b 128 T volatile_member_func4(T a0, T a1, T a2, T a3) volatile
kadonotakashi 0:8fdf9a60065b 129 {
kadonotakashi 0:8fdf9a60065b 130 return t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 131 }
kadonotakashi 0:8fdf9a60065b 132 T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile
kadonotakashi 0:8fdf9a60065b 133 {
kadonotakashi 0:8fdf9a60065b 134 return t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 135 }
kadonotakashi 0:8fdf9a60065b 136
kadonotakashi 0:8fdf9a60065b 137 T const_volatile_member_func0() const volatile
kadonotakashi 0:8fdf9a60065b 138 {
kadonotakashi 0:8fdf9a60065b 139 return t;
kadonotakashi 0:8fdf9a60065b 140 }
kadonotakashi 0:8fdf9a60065b 141 T const_volatile_member_func1(T a0) const volatile
kadonotakashi 0:8fdf9a60065b 142 {
kadonotakashi 0:8fdf9a60065b 143 return t | a0;
kadonotakashi 0:8fdf9a60065b 144 }
kadonotakashi 0:8fdf9a60065b 145 T const_volatile_member_func2(T a0, T a1) const volatile
kadonotakashi 0:8fdf9a60065b 146 {
kadonotakashi 0:8fdf9a60065b 147 return t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 148 }
kadonotakashi 0:8fdf9a60065b 149 T const_volatile_member_func3(T a0, T a1, T a2) const volatile
kadonotakashi 0:8fdf9a60065b 150 {
kadonotakashi 0:8fdf9a60065b 151 return t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 152 }
kadonotakashi 0:8fdf9a60065b 153 T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile
kadonotakashi 0:8fdf9a60065b 154 {
kadonotakashi 0:8fdf9a60065b 155 return t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 156 }
kadonotakashi 0:8fdf9a60065b 157 T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile
kadonotakashi 0:8fdf9a60065b 158 {
kadonotakashi 0:8fdf9a60065b 159 return t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 160 }
kadonotakashi 0:8fdf9a60065b 161 };
kadonotakashi 0:8fdf9a60065b 162
kadonotakashi 0:8fdf9a60065b 163 // bound functions
kadonotakashi 0:8fdf9a60065b 164 template <typename T>
kadonotakashi 0:8fdf9a60065b 165 T bound_func0(Thing<T> *t)
kadonotakashi 0:8fdf9a60065b 166 {
kadonotakashi 0:8fdf9a60065b 167 return t->t;
kadonotakashi 0:8fdf9a60065b 168 }
kadonotakashi 0:8fdf9a60065b 169 template <typename T>
kadonotakashi 0:8fdf9a60065b 170 T bound_func1(Thing<T> *t, T a0)
kadonotakashi 0:8fdf9a60065b 171 {
kadonotakashi 0:8fdf9a60065b 172 return t->t | a0;
kadonotakashi 0:8fdf9a60065b 173 }
kadonotakashi 0:8fdf9a60065b 174 template <typename T>
kadonotakashi 0:8fdf9a60065b 175 T bound_func2(Thing<T> *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 176 {
kadonotakashi 0:8fdf9a60065b 177 return t->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 178 }
kadonotakashi 0:8fdf9a60065b 179 template <typename T>
kadonotakashi 0:8fdf9a60065b 180 T bound_func3(Thing<T> *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 181 {
kadonotakashi 0:8fdf9a60065b 182 return t->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 183 }
kadonotakashi 0:8fdf9a60065b 184 template <typename T>
kadonotakashi 0:8fdf9a60065b 185 T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 186 {
kadonotakashi 0:8fdf9a60065b 187 return t->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 188 }
kadonotakashi 0:8fdf9a60065b 189 template <typename T>
kadonotakashi 0:8fdf9a60065b 190 T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 191 {
kadonotakashi 0:8fdf9a60065b 192 return t->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 193 }
kadonotakashi 0:8fdf9a60065b 194 template <typename T>
kadonotakashi 0:8fdf9a60065b 195 T const_bound_func0(const Thing<T> *t)
kadonotakashi 0:8fdf9a60065b 196 {
kadonotakashi 0:8fdf9a60065b 197 return t->t;
kadonotakashi 0:8fdf9a60065b 198 }
kadonotakashi 0:8fdf9a60065b 199 template <typename T>
kadonotakashi 0:8fdf9a60065b 200 T const_bound_func1(const Thing<T> *t, T a0)
kadonotakashi 0:8fdf9a60065b 201 {
kadonotakashi 0:8fdf9a60065b 202 return t->t | a0;
kadonotakashi 0:8fdf9a60065b 203 }
kadonotakashi 0:8fdf9a60065b 204 template <typename T>
kadonotakashi 0:8fdf9a60065b 205 T const_bound_func2(const Thing<T> *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 206 {
kadonotakashi 0:8fdf9a60065b 207 return t->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 208 }
kadonotakashi 0:8fdf9a60065b 209 template <typename T>
kadonotakashi 0:8fdf9a60065b 210 T const_bound_func3(const Thing<T> *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 211 {
kadonotakashi 0:8fdf9a60065b 212 return t->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 213 }
kadonotakashi 0:8fdf9a60065b 214 template <typename T>
kadonotakashi 0:8fdf9a60065b 215 T const_bound_func4(const Thing<T> *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 216 {
kadonotakashi 0:8fdf9a60065b 217 return t->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 218 }
kadonotakashi 0:8fdf9a60065b 219 template <typename T>
kadonotakashi 0:8fdf9a60065b 220 T const_bound_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 221 {
kadonotakashi 0:8fdf9a60065b 222 return t->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 223 }
kadonotakashi 0:8fdf9a60065b 224 template <typename T>
kadonotakashi 0:8fdf9a60065b 225 T volatile_bound_func0(volatile Thing<T> *t)
kadonotakashi 0:8fdf9a60065b 226 {
kadonotakashi 0:8fdf9a60065b 227 return t->t;
kadonotakashi 0:8fdf9a60065b 228 }
kadonotakashi 0:8fdf9a60065b 229 template <typename T>
kadonotakashi 0:8fdf9a60065b 230 T volatile_bound_func1(volatile Thing<T> *t, T a0)
kadonotakashi 0:8fdf9a60065b 231 {
kadonotakashi 0:8fdf9a60065b 232 return t->t | a0;
kadonotakashi 0:8fdf9a60065b 233 }
kadonotakashi 0:8fdf9a60065b 234 template <typename T>
kadonotakashi 0:8fdf9a60065b 235 T volatile_bound_func2(volatile Thing<T> *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 236 {
kadonotakashi 0:8fdf9a60065b 237 return t->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 238 }
kadonotakashi 0:8fdf9a60065b 239 template <typename T>
kadonotakashi 0:8fdf9a60065b 240 T volatile_bound_func3(volatile Thing<T> *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 241 {
kadonotakashi 0:8fdf9a60065b 242 return t->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 243 }
kadonotakashi 0:8fdf9a60065b 244 template <typename T>
kadonotakashi 0:8fdf9a60065b 245 T volatile_bound_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 246 {
kadonotakashi 0:8fdf9a60065b 247 return t->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 248 }
kadonotakashi 0:8fdf9a60065b 249 template <typename T>
kadonotakashi 0:8fdf9a60065b 250 T volatile_bound_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 251 {
kadonotakashi 0:8fdf9a60065b 252 return t->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 253 }
kadonotakashi 0:8fdf9a60065b 254 template <typename T>
kadonotakashi 0:8fdf9a60065b 255 T const_volatile_bound_func0(const volatile Thing<T> *t)
kadonotakashi 0:8fdf9a60065b 256 {
kadonotakashi 0:8fdf9a60065b 257 return t->t;
kadonotakashi 0:8fdf9a60065b 258 }
kadonotakashi 0:8fdf9a60065b 259 template <typename T>
kadonotakashi 0:8fdf9a60065b 260 T const_volatile_bound_func1(const volatile Thing<T> *t, T a0)
kadonotakashi 0:8fdf9a60065b 261 {
kadonotakashi 0:8fdf9a60065b 262 return t->t | a0;
kadonotakashi 0:8fdf9a60065b 263 }
kadonotakashi 0:8fdf9a60065b 264 template <typename T>
kadonotakashi 0:8fdf9a60065b 265 T const_volatile_bound_func2(const volatile Thing<T> *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 266 {
kadonotakashi 0:8fdf9a60065b 267 return t->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 268 }
kadonotakashi 0:8fdf9a60065b 269 template <typename T>
kadonotakashi 0:8fdf9a60065b 270 T const_volatile_bound_func3(const volatile Thing<T> *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 271 {
kadonotakashi 0:8fdf9a60065b 272 return t->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 273 }
kadonotakashi 0:8fdf9a60065b 274 template <typename T>
kadonotakashi 0:8fdf9a60065b 275 T const_volatile_bound_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 276 {
kadonotakashi 0:8fdf9a60065b 277 return t->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 278 }
kadonotakashi 0:8fdf9a60065b 279 template <typename T>
kadonotakashi 0:8fdf9a60065b 280 T const_volatile_bound_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 281 {
kadonotakashi 0:8fdf9a60065b 282 return t->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 283 }
kadonotakashi 0:8fdf9a60065b 284
kadonotakashi 0:8fdf9a60065b 285 // void functions
kadonotakashi 0:8fdf9a60065b 286 template <typename T>
kadonotakashi 0:8fdf9a60065b 287 T void_func0(void *t)
kadonotakashi 0:8fdf9a60065b 288 {
kadonotakashi 0:8fdf9a60065b 289 return static_cast<Thing<T>*>(t)->t;
kadonotakashi 0:8fdf9a60065b 290 }
kadonotakashi 0:8fdf9a60065b 291 template <typename T>
kadonotakashi 0:8fdf9a60065b 292 T void_func1(void *t, T a0)
kadonotakashi 0:8fdf9a60065b 293 {
kadonotakashi 0:8fdf9a60065b 294 return static_cast<Thing<T>*>(t)->t | a0;
kadonotakashi 0:8fdf9a60065b 295 }
kadonotakashi 0:8fdf9a60065b 296 template <typename T>
kadonotakashi 0:8fdf9a60065b 297 T void_func2(void *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 298 {
kadonotakashi 0:8fdf9a60065b 299 return static_cast<Thing<T>*>(t)->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 300 }
kadonotakashi 0:8fdf9a60065b 301 template <typename T>
kadonotakashi 0:8fdf9a60065b 302 T void_func3(void *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 303 {
kadonotakashi 0:8fdf9a60065b 304 return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 305 }
kadonotakashi 0:8fdf9a60065b 306 template <typename T>
kadonotakashi 0:8fdf9a60065b 307 T void_func4(void *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 308 {
kadonotakashi 0:8fdf9a60065b 309 return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 310 }
kadonotakashi 0:8fdf9a60065b 311 template <typename T>
kadonotakashi 0:8fdf9a60065b 312 T void_func5(void *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 313 {
kadonotakashi 0:8fdf9a60065b 314 return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 315 }
kadonotakashi 0:8fdf9a60065b 316 template <typename T>
kadonotakashi 0:8fdf9a60065b 317 T const_void_func0(const void *t)
kadonotakashi 0:8fdf9a60065b 318 {
kadonotakashi 0:8fdf9a60065b 319 return static_cast<const Thing<T>*>(t)->t;
kadonotakashi 0:8fdf9a60065b 320 }
kadonotakashi 0:8fdf9a60065b 321 template <typename T>
kadonotakashi 0:8fdf9a60065b 322 T const_void_func1(const void *t, T a0)
kadonotakashi 0:8fdf9a60065b 323 {
kadonotakashi 0:8fdf9a60065b 324 return static_cast<const Thing<T>*>(t)->t | a0;
kadonotakashi 0:8fdf9a60065b 325 }
kadonotakashi 0:8fdf9a60065b 326 template <typename T>
kadonotakashi 0:8fdf9a60065b 327 T const_void_func2(const void *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 328 {
kadonotakashi 0:8fdf9a60065b 329 return static_cast<const Thing<T>*>(t)->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 330 }
kadonotakashi 0:8fdf9a60065b 331 template <typename T>
kadonotakashi 0:8fdf9a60065b 332 T const_void_func3(const void *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 333 {
kadonotakashi 0:8fdf9a60065b 334 return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 335 }
kadonotakashi 0:8fdf9a60065b 336 template <typename T>
kadonotakashi 0:8fdf9a60065b 337 T const_void_func4(const void *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 338 {
kadonotakashi 0:8fdf9a60065b 339 return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 340 }
kadonotakashi 0:8fdf9a60065b 341 template <typename T>
kadonotakashi 0:8fdf9a60065b 342 T const_void_func5(const void *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 343 {
kadonotakashi 0:8fdf9a60065b 344 return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 345 }
kadonotakashi 0:8fdf9a60065b 346 template <typename T>
kadonotakashi 0:8fdf9a60065b 347 T volatile_void_func0(volatile void *t)
kadonotakashi 0:8fdf9a60065b 348 {
kadonotakashi 0:8fdf9a60065b 349 return static_cast<volatile Thing<T>*>(t)->t;
kadonotakashi 0:8fdf9a60065b 350 }
kadonotakashi 0:8fdf9a60065b 351 template <typename T>
kadonotakashi 0:8fdf9a60065b 352 T volatile_void_func1(volatile void *t, T a0)
kadonotakashi 0:8fdf9a60065b 353 {
kadonotakashi 0:8fdf9a60065b 354 return static_cast<volatile Thing<T>*>(t)->t | a0;
kadonotakashi 0:8fdf9a60065b 355 }
kadonotakashi 0:8fdf9a60065b 356 template <typename T>
kadonotakashi 0:8fdf9a60065b 357 T volatile_void_func2(volatile void *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 358 {
kadonotakashi 0:8fdf9a60065b 359 return static_cast<volatile Thing<T>*>(t)->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 360 }
kadonotakashi 0:8fdf9a60065b 361 template <typename T>
kadonotakashi 0:8fdf9a60065b 362 T volatile_void_func3(volatile void *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 363 {
kadonotakashi 0:8fdf9a60065b 364 return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 365 }
kadonotakashi 0:8fdf9a60065b 366 template <typename T>
kadonotakashi 0:8fdf9a60065b 367 T volatile_void_func4(volatile void *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 368 {
kadonotakashi 0:8fdf9a60065b 369 return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 370 }
kadonotakashi 0:8fdf9a60065b 371 template <typename T>
kadonotakashi 0:8fdf9a60065b 372 T volatile_void_func5(volatile void *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 373 {
kadonotakashi 0:8fdf9a60065b 374 return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 375 }
kadonotakashi 0:8fdf9a60065b 376 template <typename T>
kadonotakashi 0:8fdf9a60065b 377 T const_volatile_void_func0(const volatile void *t)
kadonotakashi 0:8fdf9a60065b 378 {
kadonotakashi 0:8fdf9a60065b 379 return static_cast<const volatile Thing<T>*>(t)->t;
kadonotakashi 0:8fdf9a60065b 380 }
kadonotakashi 0:8fdf9a60065b 381 template <typename T>
kadonotakashi 0:8fdf9a60065b 382 T const_volatile_void_func1(const volatile void *t, T a0)
kadonotakashi 0:8fdf9a60065b 383 {
kadonotakashi 0:8fdf9a60065b 384 return static_cast<const volatile Thing<T>*>(t)->t | a0;
kadonotakashi 0:8fdf9a60065b 385 }
kadonotakashi 0:8fdf9a60065b 386 template <typename T>
kadonotakashi 0:8fdf9a60065b 387 T const_volatile_void_func2(const volatile void *t, T a0, T a1)
kadonotakashi 0:8fdf9a60065b 388 {
kadonotakashi 0:8fdf9a60065b 389 return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1;
kadonotakashi 0:8fdf9a60065b 390 }
kadonotakashi 0:8fdf9a60065b 391 template <typename T>
kadonotakashi 0:8fdf9a60065b 392 T const_volatile_void_func3(const volatile void *t, T a0, T a1, T a2)
kadonotakashi 0:8fdf9a60065b 393 {
kadonotakashi 0:8fdf9a60065b 394 return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2;
kadonotakashi 0:8fdf9a60065b 395 }
kadonotakashi 0:8fdf9a60065b 396 template <typename T>
kadonotakashi 0:8fdf9a60065b 397 T const_volatile_void_func4(const volatile void *t, T a0, T a1, T a2, T a3)
kadonotakashi 0:8fdf9a60065b 398 {
kadonotakashi 0:8fdf9a60065b 399 return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3;
kadonotakashi 0:8fdf9a60065b 400 }
kadonotakashi 0:8fdf9a60065b 401 template <typename T>
kadonotakashi 0:8fdf9a60065b 402 T const_volatile_void_func5(const volatile void *t, T a0, T a1, T a2, T a3, T a4)
kadonotakashi 0:8fdf9a60065b 403 {
kadonotakashi 0:8fdf9a60065b 404 return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4;
kadonotakashi 0:8fdf9a60065b 405 }
kadonotakashi 0:8fdf9a60065b 406
kadonotakashi 0:8fdf9a60065b 407 // Inheriting class
kadonotakashi 0:8fdf9a60065b 408 template <typename T>
kadonotakashi 0:8fdf9a60065b 409 class Thing2 : public Thing<T> {
kadonotakashi 0:8fdf9a60065b 410 };
kadonotakashi 0:8fdf9a60065b 411
kadonotakashi 0:8fdf9a60065b 412
kadonotakashi 0:8fdf9a60065b 413 // function call and result verification
kadonotakashi 0:8fdf9a60065b 414 template <typename T>
kadonotakashi 0:8fdf9a60065b 415 struct Verifier {
kadonotakashi 0:8fdf9a60065b 416 static void verify0(Callback<T()> func)
kadonotakashi 0:8fdf9a60065b 417 {
kadonotakashi 0:8fdf9a60065b 418 T result = func();
kadonotakashi 0:8fdf9a60065b 419 TEST_ASSERT_EQUAL(result, 0x00);
kadonotakashi 0:8fdf9a60065b 420 }
kadonotakashi 0:8fdf9a60065b 421
kadonotakashi 0:8fdf9a60065b 422 template <typename O, typename M>
kadonotakashi 0:8fdf9a60065b 423 static void verify0(O *obj, M method)
kadonotakashi 0:8fdf9a60065b 424 {
kadonotakashi 0:8fdf9a60065b 425 Callback<T()> func(obj, method);
kadonotakashi 0:8fdf9a60065b 426 T result = func();
kadonotakashi 0:8fdf9a60065b 427 TEST_ASSERT_EQUAL(result, 0x80);
kadonotakashi 0:8fdf9a60065b 428 }
kadonotakashi 0:8fdf9a60065b 429
kadonotakashi 0:8fdf9a60065b 430 static void verify1(Callback<T(T)> func)
kadonotakashi 0:8fdf9a60065b 431 {
kadonotakashi 0:8fdf9a60065b 432 T result = func((1 << 0));
kadonotakashi 0:8fdf9a60065b 433 TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0));
kadonotakashi 0:8fdf9a60065b 434 }
kadonotakashi 0:8fdf9a60065b 435
kadonotakashi 0:8fdf9a60065b 436 template <typename O, typename M>
kadonotakashi 0:8fdf9a60065b 437 static void verify1(O *obj, M method)
kadonotakashi 0:8fdf9a60065b 438 {
kadonotakashi 0:8fdf9a60065b 439 Callback<T(T)> func(obj, method);
kadonotakashi 0:8fdf9a60065b 440 T result = func((1 << 0));
kadonotakashi 0:8fdf9a60065b 441 TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0));
kadonotakashi 0:8fdf9a60065b 442 }
kadonotakashi 0:8fdf9a60065b 443
kadonotakashi 0:8fdf9a60065b 444 static void verify2(Callback<T(T, T)> func)
kadonotakashi 0:8fdf9a60065b 445 {
kadonotakashi 0:8fdf9a60065b 446 T result = func((1 << 0), (1 << 1));
kadonotakashi 0:8fdf9a60065b 447 TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1));
kadonotakashi 0:8fdf9a60065b 448 }
kadonotakashi 0:8fdf9a60065b 449
kadonotakashi 0:8fdf9a60065b 450 template <typename O, typename M>
kadonotakashi 0:8fdf9a60065b 451 static void verify2(O *obj, M method)
kadonotakashi 0:8fdf9a60065b 452 {
kadonotakashi 0:8fdf9a60065b 453 Callback<T(T, T)> func(obj, method);
kadonotakashi 0:8fdf9a60065b 454 T result = func((1 << 0), (1 << 1));
kadonotakashi 0:8fdf9a60065b 455 TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1));
kadonotakashi 0:8fdf9a60065b 456 }
kadonotakashi 0:8fdf9a60065b 457
kadonotakashi 0:8fdf9a60065b 458 static void verify3(Callback<T(T, T, T)> func)
kadonotakashi 0:8fdf9a60065b 459 {
kadonotakashi 0:8fdf9a60065b 460 T result = func((1 << 0), (1 << 1), (1 << 2));
kadonotakashi 0:8fdf9a60065b 461 TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2));
kadonotakashi 0:8fdf9a60065b 462 }
kadonotakashi 0:8fdf9a60065b 463
kadonotakashi 0:8fdf9a60065b 464 template <typename O, typename M>
kadonotakashi 0:8fdf9a60065b 465 static void verify3(O *obj, M method)
kadonotakashi 0:8fdf9a60065b 466 {
kadonotakashi 0:8fdf9a60065b 467 Callback<T(T, T, T)> func(obj, method);
kadonotakashi 0:8fdf9a60065b 468 T result = func((1 << 0), (1 << 1), (1 << 2));
kadonotakashi 0:8fdf9a60065b 469 TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2));
kadonotakashi 0:8fdf9a60065b 470 }
kadonotakashi 0:8fdf9a60065b 471
kadonotakashi 0:8fdf9a60065b 472 static void verify4(Callback<T(T, T, T, T)> func)
kadonotakashi 0:8fdf9a60065b 473 {
kadonotakashi 0:8fdf9a60065b 474 T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3));
kadonotakashi 0:8fdf9a60065b 475 TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3));
kadonotakashi 0:8fdf9a60065b 476 }
kadonotakashi 0:8fdf9a60065b 477
kadonotakashi 0:8fdf9a60065b 478 template <typename O, typename M>
kadonotakashi 0:8fdf9a60065b 479 static void verify4(O *obj, M method)
kadonotakashi 0:8fdf9a60065b 480 {
kadonotakashi 0:8fdf9a60065b 481 Callback<T(T, T, T, T)> func(obj, method);
kadonotakashi 0:8fdf9a60065b 482 T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3));
kadonotakashi 0:8fdf9a60065b 483 TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3));
kadonotakashi 0:8fdf9a60065b 484 }
kadonotakashi 0:8fdf9a60065b 485
kadonotakashi 0:8fdf9a60065b 486 static void verify5(Callback<T(T, T, T, T, T)> func)
kadonotakashi 0:8fdf9a60065b 487 {
kadonotakashi 0:8fdf9a60065b 488 T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4));
kadonotakashi 0:8fdf9a60065b 489 TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));
kadonotakashi 0:8fdf9a60065b 490 }
kadonotakashi 0:8fdf9a60065b 491
kadonotakashi 0:8fdf9a60065b 492 template <typename O, typename M>
kadonotakashi 0:8fdf9a60065b 493 static void verify5(O *obj, M method)
kadonotakashi 0:8fdf9a60065b 494 {
kadonotakashi 0:8fdf9a60065b 495 Callback<T(T, T, T, T, T)> func(obj, method);
kadonotakashi 0:8fdf9a60065b 496 T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4));
kadonotakashi 0:8fdf9a60065b 497 TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));
kadonotakashi 0:8fdf9a60065b 498 }
kadonotakashi 0:8fdf9a60065b 499 };
kadonotakashi 0:8fdf9a60065b 500
kadonotakashi 0:8fdf9a60065b 501
kadonotakashi 0:8fdf9a60065b 502 // test dispatch
kadonotakashi 0:8fdf9a60065b 503 template <typename T>
kadonotakashi 0:8fdf9a60065b 504 void test_dispatch0()
kadonotakashi 0:8fdf9a60065b 505 {
kadonotakashi 0:8fdf9a60065b 506 Thing<T> thing;
kadonotakashi 0:8fdf9a60065b 507 Thing2<T> thing2;
kadonotakashi 0:8fdf9a60065b 508 Verifier<T>::verify0(static_func0<T>);
kadonotakashi 0:8fdf9a60065b 509 Verifier<T>::verify0(&thing, &Thing<T>::member_func0);
kadonotakashi 0:8fdf9a60065b 510 Verifier<T>::verify0((const Thing<T> *)&thing, &Thing<T>::const_member_func0);
kadonotakashi 0:8fdf9a60065b 511 Verifier<T>::verify0((volatile Thing<T> *)&thing, &Thing<T>::volatile_member_func0);
kadonotakashi 0:8fdf9a60065b 512 Verifier<T>::verify0((const volatile Thing<T> *)&thing, &Thing<T>::const_volatile_member_func0);
kadonotakashi 0:8fdf9a60065b 513 Verifier<T>::verify0(&thing2, &Thing2<T>::member_func0);
kadonotakashi 0:8fdf9a60065b 514 Verifier<T>::verify0(&bound_func0<T>, &thing);
kadonotakashi 0:8fdf9a60065b 515 Verifier<T>::verify0(&const_bound_func0<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 516 Verifier<T>::verify0(&volatile_bound_func0<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 517 Verifier<T>::verify0(&const_volatile_bound_func0<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 518 Verifier<T>::verify0(&bound_func0<T>, &thing2);
kadonotakashi 0:8fdf9a60065b 519 Verifier<T>::verify0(&void_func0<T>, &thing);
kadonotakashi 0:8fdf9a60065b 520 Verifier<T>::verify0(&const_void_func0<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 521 Verifier<T>::verify0(&volatile_void_func0<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 522 Verifier<T>::verify0(&const_volatile_void_func0<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 523 Verifier<T>::verify0(callback(static_func0<T>));
kadonotakashi 0:8fdf9a60065b 524
kadonotakashi 0:8fdf9a60065b 525 Callback<T()> cb(static_func0);
kadonotakashi 0:8fdf9a60065b 526 Verifier<T>::verify0(cb);
kadonotakashi 0:8fdf9a60065b 527 cb = static_func0;
kadonotakashi 0:8fdf9a60065b 528 Verifier<T>::verify0(cb);
kadonotakashi 0:8fdf9a60065b 529 cb.attach(&bound_func0<T>, &thing);
kadonotakashi 0:8fdf9a60065b 530 Verifier<T>::verify0(&cb, &Callback<T()>::call);
kadonotakashi 0:8fdf9a60065b 531 Verifier<T>::verify0(&Callback<T()>::thunk, (void *)&cb);
kadonotakashi 0:8fdf9a60065b 532 }
kadonotakashi 0:8fdf9a60065b 533
kadonotakashi 0:8fdf9a60065b 534 template <typename T>
kadonotakashi 0:8fdf9a60065b 535 void test_dispatch1()
kadonotakashi 0:8fdf9a60065b 536 {
kadonotakashi 0:8fdf9a60065b 537 Thing<T> thing;
kadonotakashi 0:8fdf9a60065b 538 Thing2<T> thing2;
kadonotakashi 0:8fdf9a60065b 539 Verifier<T>::verify1(static_func1<T>);
kadonotakashi 0:8fdf9a60065b 540 Verifier<T>::verify1(&thing, &Thing<T>::member_func1);
kadonotakashi 0:8fdf9a60065b 541 Verifier<T>::verify1((const Thing<T> *)&thing, &Thing<T>::const_member_func1);
kadonotakashi 0:8fdf9a60065b 542 Verifier<T>::verify1((volatile Thing<T> *)&thing, &Thing<T>::volatile_member_func1);
kadonotakashi 0:8fdf9a60065b 543 Verifier<T>::verify1((const volatile Thing<T> *)&thing, &Thing<T>::const_volatile_member_func1);
kadonotakashi 0:8fdf9a60065b 544 Verifier<T>::verify1(&thing2, &Thing2<T>::member_func1);
kadonotakashi 0:8fdf9a60065b 545 Verifier<T>::verify1(&bound_func1<T>, &thing);
kadonotakashi 0:8fdf9a60065b 546 Verifier<T>::verify1(&const_bound_func1<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 547 Verifier<T>::verify1(&volatile_bound_func1<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 548 Verifier<T>::verify1(&const_volatile_bound_func1<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 549 Verifier<T>::verify1(&bound_func1<T>, &thing2);
kadonotakashi 0:8fdf9a60065b 550 Verifier<T>::verify1(&void_func1<T>, &thing);
kadonotakashi 0:8fdf9a60065b 551 Verifier<T>::verify1(&const_void_func1<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 552 Verifier<T>::verify1(&volatile_void_func1<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 553 Verifier<T>::verify1(&const_volatile_void_func1<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 554 Verifier<T>::verify1(callback(static_func1<T>));
kadonotakashi 0:8fdf9a60065b 555
kadonotakashi 0:8fdf9a60065b 556 Callback<T(T)> cb(static_func1);
kadonotakashi 0:8fdf9a60065b 557 Verifier<T>::verify1(cb);
kadonotakashi 0:8fdf9a60065b 558 cb = static_func1;
kadonotakashi 0:8fdf9a60065b 559 Verifier<T>::verify1(cb);
kadonotakashi 0:8fdf9a60065b 560 cb.attach(&bound_func1<T>, &thing);
kadonotakashi 0:8fdf9a60065b 561 Verifier<T>::verify1(&cb, &Callback<T(T)>::call);
kadonotakashi 0:8fdf9a60065b 562 Verifier<T>::verify1(&Callback<T(T)>::thunk, (void *)&cb);
kadonotakashi 0:8fdf9a60065b 563 }
kadonotakashi 0:8fdf9a60065b 564
kadonotakashi 0:8fdf9a60065b 565 template <typename T>
kadonotakashi 0:8fdf9a60065b 566 void test_dispatch2()
kadonotakashi 0:8fdf9a60065b 567 {
kadonotakashi 0:8fdf9a60065b 568 Thing<T> thing;
kadonotakashi 0:8fdf9a60065b 569 Thing2<T> thing2;
kadonotakashi 0:8fdf9a60065b 570 Verifier<T>::verify2(static_func2<T>);
kadonotakashi 0:8fdf9a60065b 571 Verifier<T>::verify2(&thing, &Thing<T>::member_func2);
kadonotakashi 0:8fdf9a60065b 572 Verifier<T>::verify2((const Thing<T> *)&thing, &Thing<T>::const_member_func2);
kadonotakashi 0:8fdf9a60065b 573 Verifier<T>::verify2((volatile Thing<T> *)&thing, &Thing<T>::volatile_member_func2);
kadonotakashi 0:8fdf9a60065b 574 Verifier<T>::verify2((const volatile Thing<T> *)&thing, &Thing<T>::const_volatile_member_func2);
kadonotakashi 0:8fdf9a60065b 575 Verifier<T>::verify2(&thing2, &Thing2<T>::member_func2);
kadonotakashi 0:8fdf9a60065b 576 Verifier<T>::verify2(&bound_func2<T>, &thing);
kadonotakashi 0:8fdf9a60065b 577 Verifier<T>::verify2(&const_bound_func2<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 578 Verifier<T>::verify2(&volatile_bound_func2<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 579 Verifier<T>::verify2(&const_volatile_bound_func2<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 580 Verifier<T>::verify2(&bound_func2<T>, &thing2);
kadonotakashi 0:8fdf9a60065b 581 Verifier<T>::verify2(&void_func2<T>, &thing);
kadonotakashi 0:8fdf9a60065b 582 Verifier<T>::verify2(&const_void_func2<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 583 Verifier<T>::verify2(&volatile_void_func2<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 584 Verifier<T>::verify2(&const_volatile_void_func2<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 585 Verifier<T>::verify2(callback(static_func2<T>));
kadonotakashi 0:8fdf9a60065b 586
kadonotakashi 0:8fdf9a60065b 587 Callback<T(T, T)> cb(static_func2);
kadonotakashi 0:8fdf9a60065b 588 Verifier<T>::verify2(cb);
kadonotakashi 0:8fdf9a60065b 589 cb = static_func2;
kadonotakashi 0:8fdf9a60065b 590 Verifier<T>::verify2(cb);
kadonotakashi 0:8fdf9a60065b 591 cb.attach(&bound_func2<T>, &thing);
kadonotakashi 0:8fdf9a60065b 592 Verifier<T>::verify2(&cb, &Callback<T(T, T)>::call);
kadonotakashi 0:8fdf9a60065b 593 Verifier<T>::verify2(&Callback<T(T, T)>::thunk, (void *)&cb);
kadonotakashi 0:8fdf9a60065b 594 }
kadonotakashi 0:8fdf9a60065b 595
kadonotakashi 0:8fdf9a60065b 596 template <typename T>
kadonotakashi 0:8fdf9a60065b 597 void test_dispatch3()
kadonotakashi 0:8fdf9a60065b 598 {
kadonotakashi 0:8fdf9a60065b 599 Thing<T> thing;
kadonotakashi 0:8fdf9a60065b 600 Thing2<T> thing2;
kadonotakashi 0:8fdf9a60065b 601 Verifier<T>::verify3(static_func3<T>);
kadonotakashi 0:8fdf9a60065b 602 Verifier<T>::verify3(&thing, &Thing<T>::member_func3);
kadonotakashi 0:8fdf9a60065b 603 Verifier<T>::verify3((const Thing<T> *)&thing, &Thing<T>::const_member_func3);
kadonotakashi 0:8fdf9a60065b 604 Verifier<T>::verify3((volatile Thing<T> *)&thing, &Thing<T>::volatile_member_func3);
kadonotakashi 0:8fdf9a60065b 605 Verifier<T>::verify3((const volatile Thing<T> *)&thing, &Thing<T>::const_volatile_member_func3);
kadonotakashi 0:8fdf9a60065b 606 Verifier<T>::verify3(&thing2, &Thing2<T>::member_func3);
kadonotakashi 0:8fdf9a60065b 607 Verifier<T>::verify3(&bound_func3<T>, &thing);
kadonotakashi 0:8fdf9a60065b 608 Verifier<T>::verify3(&const_bound_func3<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 609 Verifier<T>::verify3(&volatile_bound_func3<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 610 Verifier<T>::verify3(&const_volatile_bound_func3<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 611 Verifier<T>::verify3(&bound_func3<T>, &thing2);
kadonotakashi 0:8fdf9a60065b 612 Verifier<T>::verify3(&void_func3<T>, &thing);
kadonotakashi 0:8fdf9a60065b 613 Verifier<T>::verify3(&const_void_func3<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 614 Verifier<T>::verify3(&volatile_void_func3<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 615 Verifier<T>::verify3(&const_volatile_void_func3<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 616 Verifier<T>::verify3(callback(static_func3<T>));
kadonotakashi 0:8fdf9a60065b 617
kadonotakashi 0:8fdf9a60065b 618 Callback<T(T, T, T)> cb(static_func3);
kadonotakashi 0:8fdf9a60065b 619 Verifier<T>::verify3(cb);
kadonotakashi 0:8fdf9a60065b 620 cb = static_func3;
kadonotakashi 0:8fdf9a60065b 621 Verifier<T>::verify3(cb);
kadonotakashi 0:8fdf9a60065b 622 cb.attach(&bound_func3<T>, &thing);
kadonotakashi 0:8fdf9a60065b 623 Verifier<T>::verify3(&cb, &Callback<T(T, T, T)>::call);
kadonotakashi 0:8fdf9a60065b 624 Verifier<T>::verify3(&Callback<T(T, T, T)>::thunk, (void *)&cb);
kadonotakashi 0:8fdf9a60065b 625 }
kadonotakashi 0:8fdf9a60065b 626
kadonotakashi 0:8fdf9a60065b 627 template <typename T>
kadonotakashi 0:8fdf9a60065b 628 void test_dispatch4()
kadonotakashi 0:8fdf9a60065b 629 {
kadonotakashi 0:8fdf9a60065b 630 Thing<T> thing;
kadonotakashi 0:8fdf9a60065b 631 Thing2<T> thing2;
kadonotakashi 0:8fdf9a60065b 632 Verifier<T>::verify4(static_func4<T>);
kadonotakashi 0:8fdf9a60065b 633 Verifier<T>::verify4(&thing, &Thing<T>::member_func4);
kadonotakashi 0:8fdf9a60065b 634 Verifier<T>::verify4((const Thing<T> *)&thing, &Thing<T>::const_member_func4);
kadonotakashi 0:8fdf9a60065b 635 Verifier<T>::verify4((volatile Thing<T> *)&thing, &Thing<T>::volatile_member_func4);
kadonotakashi 0:8fdf9a60065b 636 Verifier<T>::verify4((const volatile Thing<T> *)&thing, &Thing<T>::const_volatile_member_func4);
kadonotakashi 0:8fdf9a60065b 637 Verifier<T>::verify4(&thing2, &Thing2<T>::member_func4);
kadonotakashi 0:8fdf9a60065b 638 Verifier<T>::verify4(&bound_func4<T>, &thing);
kadonotakashi 0:8fdf9a60065b 639 Verifier<T>::verify4(&const_bound_func4<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 640 Verifier<T>::verify4(&volatile_bound_func4<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 641 Verifier<T>::verify4(&const_volatile_bound_func4<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 642 Verifier<T>::verify4(&bound_func4<T>, &thing2);
kadonotakashi 0:8fdf9a60065b 643 Verifier<T>::verify4(&void_func4<T>, &thing);
kadonotakashi 0:8fdf9a60065b 644 Verifier<T>::verify4(&const_void_func4<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 645 Verifier<T>::verify4(&volatile_void_func4<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 646 Verifier<T>::verify4(&const_volatile_void_func4<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 647 Verifier<T>::verify4(callback(static_func4<T>));
kadonotakashi 0:8fdf9a60065b 648
kadonotakashi 0:8fdf9a60065b 649 Callback<T(T, T, T, T)> cb(static_func4);
kadonotakashi 0:8fdf9a60065b 650 Verifier<T>::verify4(cb);
kadonotakashi 0:8fdf9a60065b 651 cb = static_func4;
kadonotakashi 0:8fdf9a60065b 652 Verifier<T>::verify4(cb);
kadonotakashi 0:8fdf9a60065b 653 cb.attach(&bound_func4<T>, &thing);
kadonotakashi 0:8fdf9a60065b 654 Verifier<T>::verify4(&cb, &Callback<T(T, T, T, T)>::call);
kadonotakashi 0:8fdf9a60065b 655 Verifier<T>::verify4(&Callback<T(T, T, T, T)>::thunk, (void *)&cb);
kadonotakashi 0:8fdf9a60065b 656 }
kadonotakashi 0:8fdf9a60065b 657
kadonotakashi 0:8fdf9a60065b 658 template <typename T>
kadonotakashi 0:8fdf9a60065b 659 void test_dispatch5()
kadonotakashi 0:8fdf9a60065b 660 {
kadonotakashi 0:8fdf9a60065b 661 Thing<T> thing;
kadonotakashi 0:8fdf9a60065b 662 Thing2<T> thing2;
kadonotakashi 0:8fdf9a60065b 663 Verifier<T>::verify5(static_func5<T>);
kadonotakashi 0:8fdf9a60065b 664 Verifier<T>::verify5(&thing, &Thing<T>::member_func5);
kadonotakashi 0:8fdf9a60065b 665 Verifier<T>::verify5((const Thing<T> *)&thing, &Thing<T>::const_member_func5);
kadonotakashi 0:8fdf9a60065b 666 Verifier<T>::verify5((volatile Thing<T> *)&thing, &Thing<T>::volatile_member_func5);
kadonotakashi 0:8fdf9a60065b 667 Verifier<T>::verify5((const volatile Thing<T> *)&thing, &Thing<T>::const_volatile_member_func5);
kadonotakashi 0:8fdf9a60065b 668 Verifier<T>::verify5(&thing2, &Thing2<T>::member_func5);
kadonotakashi 0:8fdf9a60065b 669 Verifier<T>::verify5(&bound_func5<T>, &thing);
kadonotakashi 0:8fdf9a60065b 670 Verifier<T>::verify5(&const_bound_func5<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 671 Verifier<T>::verify5(&volatile_bound_func5<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 672 Verifier<T>::verify5(&const_volatile_bound_func5<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 673 Verifier<T>::verify5(&bound_func5<T>, &thing2);
kadonotakashi 0:8fdf9a60065b 674 Verifier<T>::verify5(&void_func5<T>, &thing);
kadonotakashi 0:8fdf9a60065b 675 Verifier<T>::verify5(&const_void_func5<T>, (const Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 676 Verifier<T>::verify5(&volatile_void_func5<T>, (volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 677 Verifier<T>::verify5(&const_volatile_void_func5<T>, (const volatile Thing<T> *)&thing);
kadonotakashi 0:8fdf9a60065b 678 Verifier<T>::verify5(callback(static_func5<T>));
kadonotakashi 0:8fdf9a60065b 679
kadonotakashi 0:8fdf9a60065b 680 Callback<T(T, T, T, T, T)> cb(static_func5);
kadonotakashi 0:8fdf9a60065b 681 Verifier<T>::verify5(cb);
kadonotakashi 0:8fdf9a60065b 682 cb = static_func5;
kadonotakashi 0:8fdf9a60065b 683 Verifier<T>::verify5(cb);
kadonotakashi 0:8fdf9a60065b 684 cb.attach(&bound_func5<T>, &thing);
kadonotakashi 0:8fdf9a60065b 685 Verifier<T>::verify5(&cb, &Callback<T(T, T, T, T, T)>::call);
kadonotakashi 0:8fdf9a60065b 686 Verifier<T>::verify5(&Callback<T(T, T, T, T, T)>::thunk, (void *)&cb);
kadonotakashi 0:8fdf9a60065b 687 }
kadonotakashi 0:8fdf9a60065b 688
kadonotakashi 0:8fdf9a60065b 689
kadonotakashi 0:8fdf9a60065b 690 // Test setup
kadonotakashi 0:8fdf9a60065b 691 utest::v1::status_t test_setup(const size_t number_of_cases)
kadonotakashi 0:8fdf9a60065b 692 {
kadonotakashi 0:8fdf9a60065b 693 GREENTEA_SETUP(10, "default_auto");
kadonotakashi 0:8fdf9a60065b 694 return verbose_test_setup_handler(number_of_cases);
kadonotakashi 0:8fdf9a60065b 695 }
kadonotakashi 0:8fdf9a60065b 696
kadonotakashi 0:8fdf9a60065b 697 Case cases[] = {
kadonotakashi 0:8fdf9a60065b 698 Case("Testing callbacks with 0 ints", test_dispatch0<int>),
kadonotakashi 0:8fdf9a60065b 699 Case("Testing callbacks with 1 ints", test_dispatch1<int>),
kadonotakashi 0:8fdf9a60065b 700 Case("Testing callbacks with 2 ints", test_dispatch2<int>),
kadonotakashi 0:8fdf9a60065b 701 Case("Testing callbacks with 3 ints", test_dispatch3<int>),
kadonotakashi 0:8fdf9a60065b 702 Case("Testing callbacks with 4 ints", test_dispatch4<int>),
kadonotakashi 0:8fdf9a60065b 703 Case("Testing callbacks with 5 ints", test_dispatch5<int>),
kadonotakashi 0:8fdf9a60065b 704 };
kadonotakashi 0:8fdf9a60065b 705
kadonotakashi 0:8fdf9a60065b 706 Specification specification(test_setup, cases);
kadonotakashi 0:8fdf9a60065b 707
kadonotakashi 0:8fdf9a60065b 708 int main()
kadonotakashi 0:8fdf9a60065b 709 {
kadonotakashi 0:8fdf9a60065b 710 return !Harness::run(specification);
kadonotakashi 0:8fdf9a60065b 711 }