Lee Kai Xuan / mbed-os

Fork of mbed-os by erkin yucel

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "greentea-client/test_env.h"
00003 #include "unity.h"
00004 #include "utest.h"
00005 
00006 using namespace utest::v1;
00007 
00008 
00009 // static functions
00010 template <typename T>
00011 T static_func0()
00012     { return 0; }
00013 template <typename T>
00014 T static_func1(T a0)
00015     { return 0 | a0; }
00016 template <typename T>
00017 T static_func2(T a0, T a1)
00018     { return 0 | a0 | a1; }
00019 template <typename T>
00020 T static_func3(T a0, T a1, T a2)
00021     { return 0 | a0 | a1 | a2; }
00022 template <typename T>
00023 T static_func4(T a0, T a1, T a2, T a3)
00024     { return 0 | a0 | a1 | a2 | a3; }
00025 template <typename T>
00026 T static_func5(T a0, T a1, T a2, T a3, T a4)
00027     { return 0 | a0 | a1 | a2 | a3 | a4; }
00028 
00029 // class functions
00030 template <typename T>
00031 struct Thing {
00032     T t;
00033     Thing() : t(0x80) {}
00034 
00035     T member_func0()
00036         { return t; }
00037     T member_func1(T a0)
00038         { return t | a0; }
00039     T member_func2(T a0, T a1)
00040         { return t | a0 | a1; }
00041     T member_func3(T a0, T a1, T a2)
00042         { return t | a0 | a1 | a2; }
00043     T member_func4(T a0, T a1, T a2, T a3)
00044         { return t | a0 | a1 | a2 | a3; }
00045     T member_func5(T a0, T a1, T a2, T a3, T a4)
00046         { return t | a0 | a1 | a2 | a3 | a4; }
00047 
00048     T const_member_func0() const
00049         { return t; }
00050     T const_member_func1(T a0) const
00051         { return t | a0; }
00052     T const_member_func2(T a0, T a1) const
00053         { return t | a0 | a1; }
00054     T const_member_func3(T a0, T a1, T a2) const
00055         { return t | a0 | a1 | a2; }
00056     T const_member_func4(T a0, T a1, T a2, T a3) const
00057         { return t | a0 | a1 | a2 | a3; }
00058     T const_member_func5(T a0, T a1, T a2, T a3, T a4) const
00059         { return t | a0 | a1 | a2 | a3 | a4; }
00060 
00061     T volatile_member_func0() volatile
00062         { return t; }
00063     T volatile_member_func1(T a0) volatile
00064         { return t | a0; }
00065     T volatile_member_func2(T a0, T a1) volatile
00066         { return t | a0 | a1; }
00067     T volatile_member_func3(T a0, T a1, T a2) volatile
00068         { return t | a0 | a1 | a2; }
00069     T volatile_member_func4(T a0, T a1, T a2, T a3) volatile
00070         { return t | a0 | a1 | a2 | a3; }
00071     T volatile_member_func5(T a0, T a1, T a2, T a3, T a4) volatile
00072         { return t | a0 | a1 | a2 | a3 | a4; }
00073 
00074     T const_volatile_member_func0() const volatile
00075         { return t; }
00076     T const_volatile_member_func1(T a0) const volatile
00077         { return t | a0; }
00078     T const_volatile_member_func2(T a0, T a1) const volatile
00079         { return t | a0 | a1; }
00080     T const_volatile_member_func3(T a0, T a1, T a2) const volatile
00081         { return t | a0 | a1 | a2; }
00082     T const_volatile_member_func4(T a0, T a1, T a2, T a3) const volatile
00083         { return t | a0 | a1 | a2 | a3; }
00084     T const_volatile_member_func5(T a0, T a1, T a2, T a3, T a4) const volatile
00085         { return t | a0 | a1 | a2 | a3 | a4; }
00086 };
00087 
00088 // bound functions
00089 template <typename T>
00090 T bound_func0(Thing<T> *t)
00091     { return t->t; }
00092 template <typename T>
00093 T bound_func1(Thing<T> *t, T a0)
00094     { return t->t | a0; }
00095 template <typename T>
00096 T bound_func2(Thing<T> *t, T a0, T a1)
00097     { return t->t | a0 | a1; }
00098 template <typename T>
00099 T bound_func3(Thing<T> *t, T a0, T a1, T a2)
00100     { return t->t | a0 | a1 | a2; }
00101 template <typename T>
00102 T bound_func4(Thing<T> *t, T a0, T a1, T a2, T a3)
00103     { return t->t | a0 | a1 | a2 | a3; }
00104 template <typename T>
00105 T bound_func5(Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
00106     { return t->t | a0 | a1 | a2 | a3 | a4; }
00107 template <typename T>
00108 T const_bound_func0(const Thing<T> *t)
00109     { return t->t; }
00110 template <typename T>
00111 T const_bound_func1(const Thing<T> *t, T a0)
00112     { return t->t | a0; }
00113 template <typename T>
00114 T const_bound_func2(const Thing<T> *t, T a0, T a1)
00115     { return t->t | a0 | a1; }
00116 template <typename T>
00117 T const_bound_func3(const Thing<T> *t, T a0, T a1, T a2)
00118     { return t->t | a0 | a1 | a2; }
00119 template <typename T>
00120 T const_bound_func4(const Thing<T> *t, T a0, T a1, T a2, T a3)
00121     { return t->t | a0 | a1 | a2 | a3; }
00122 template <typename T>
00123 T const_bound_func5(const Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
00124     { return t->t | a0 | a1 | a2 | a3 | a4; }
00125 template <typename T>
00126 T volatile_bound_func0(volatile Thing<T> *t)
00127     { return t->t; }
00128 template <typename T>
00129 T volatile_bound_func1(volatile Thing<T> *t, T a0)
00130     { return t->t | a0; }
00131 template <typename T>
00132 T volatile_bound_func2(volatile Thing<T> *t, T a0, T a1)
00133     { return t->t | a0 | a1; }
00134 template <typename T>
00135 T volatile_bound_func3(volatile Thing<T> *t, T a0, T a1, T a2)
00136     { return t->t | a0 | a1 | a2; }
00137 template <typename T>
00138 T volatile_bound_func4(volatile Thing<T> *t, T a0, T a1, T a2, T a3)
00139     { return t->t | a0 | a1 | a2 | a3; }
00140 template <typename T>
00141 T volatile_bound_func5(volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
00142     { return t->t | a0 | a1 | a2 | a3 | a4; }
00143 template <typename T>
00144 T const_volatile_bound_func0(const volatile Thing<T> *t)
00145     { return t->t; }
00146 template <typename T>
00147 T const_volatile_bound_func1(const volatile Thing<T> *t, T a0)
00148     { return t->t | a0; }
00149 template <typename T>
00150 T const_volatile_bound_func2(const volatile Thing<T> *t, T a0, T a1)
00151     { return t->t | a0 | a1; }
00152 template <typename T>
00153 T const_volatile_bound_func3(const volatile Thing<T> *t, T a0, T a1, T a2)
00154     { return t->t | a0 | a1 | a2; }
00155 template <typename T>
00156 T const_volatile_bound_func4(const volatile Thing<T> *t, T a0, T a1, T a2, T a3)
00157     { return t->t | a0 | a1 | a2 | a3; }
00158 template <typename T>
00159 T const_volatile_bound_func5(const volatile Thing<T> *t, T a0, T a1, T a2, T a3, T a4)
00160     { return t->t | a0 | a1 | a2 | a3 | a4; }
00161 
00162 // void functions
00163 template <typename T>
00164 T void_func0(void *t)
00165     { return static_cast<Thing<T>*>(t)->t; }
00166 template <typename T>
00167 T void_func1(void *t, T a0)
00168     { return static_cast<Thing<T>*>(t)->t | a0; }
00169 template <typename T>
00170 T void_func2(void *t, T a0, T a1)
00171     { return static_cast<Thing<T>*>(t)->t | a0 | a1; }
00172 template <typename T>
00173 T void_func3(void *t, T a0, T a1, T a2)
00174     { return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2; }
00175 template <typename T>
00176 T void_func4(void *t, T a0, T a1, T a2, T a3)
00177     { return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
00178 template <typename T>
00179 T void_func5(void *t, T a0, T a1, T a2, T a3, T a4)
00180     { return static_cast<Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
00181 template <typename T>
00182 T const_void_func0(const void *t)
00183     { return static_cast<const Thing<T>*>(t)->t; }
00184 template <typename T>
00185 T const_void_func1(const void *t, T a0)
00186     { return static_cast<const Thing<T>*>(t)->t | a0; }
00187 template <typename T>
00188 T const_void_func2(const void *t, T a0, T a1)
00189     { return static_cast<const Thing<T>*>(t)->t | a0 | a1; }
00190 template <typename T>
00191 T const_void_func3(const void *t, T a0, T a1, T a2)
00192     { return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2; }
00193 template <typename T>
00194 T const_void_func4(const void *t, T a0, T a1, T a2, T a3)
00195     { return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
00196 template <typename T>
00197 T const_void_func5(const void *t, T a0, T a1, T a2, T a3, T a4)
00198     { return static_cast<const Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
00199 template <typename T>
00200 T volatile_void_func0(volatile void *t)
00201     { return static_cast<volatile Thing<T>*>(t)->t; }
00202 template <typename T>
00203 T volatile_void_func1(volatile void *t, T a0)
00204     { return static_cast<volatile Thing<T>*>(t)->t | a0; }
00205 template <typename T>
00206 T volatile_void_func2(volatile void *t, T a0, T a1)
00207     { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1; }
00208 template <typename T>
00209 T volatile_void_func3(volatile void *t, T a0, T a1, T a2)
00210     { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2; }
00211 template <typename T>
00212 T volatile_void_func4(volatile void *t, T a0, T a1, T a2, T a3)
00213     { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
00214 template <typename T>
00215 T volatile_void_func5(volatile void *t, T a0, T a1, T a2, T a3, T a4)
00216     { return static_cast<volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
00217 template <typename T>
00218 T const_volatile_void_func0(const volatile void *t)
00219     { return static_cast<const volatile Thing<T>*>(t)->t; }
00220 template <typename T>
00221 T const_volatile_void_func1(const volatile void *t, T a0)
00222     { return static_cast<const volatile Thing<T>*>(t)->t | a0; }
00223 template <typename T>
00224 T const_volatile_void_func2(const volatile void *t, T a0, T a1)
00225     { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1; }
00226 template <typename T>
00227 T const_volatile_void_func3(const volatile void *t, T a0, T a1, T a2)
00228     { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2; }
00229 template <typename T>
00230 T const_volatile_void_func4(const volatile void *t, T a0, T a1, T a2, T a3)
00231     { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3; }
00232 template <typename T>
00233 T const_volatile_void_func5(const volatile void *t, T a0, T a1, T a2, T a3, T a4)
00234     { return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
00235 
00236 
00237 // function call and result verification
00238 template <typename T>
00239 struct Verifier {
00240     static void verify0(Callback<T()> func) {
00241         T result = func();
00242         TEST_ASSERT_EQUAL(result, 0x00);
00243     }
00244 
00245     template <typename O, typename M>
00246     static void verify0(O *obj, M method) {
00247         Callback<T()> func(obj, method);
00248         T result = func();
00249         TEST_ASSERT_EQUAL(result, 0x80);
00250     }
00251 
00252     static void verify1(Callback<T(T)> func) {
00253         T result = func((1 << 0));
00254         TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0));
00255     }
00256 
00257     template <typename O, typename M>
00258     static void verify1(O *obj, M method) {
00259         Callback<T(T)> func(obj, method);
00260         T result = func((1 << 0));
00261         TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0));
00262     }
00263 
00264     static void verify2(Callback<T(T, T)> func) {
00265         T result = func((1 << 0), (1 << 1));
00266         TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1));
00267     }
00268 
00269     template <typename O, typename M>
00270     static void verify2(O *obj, M method) {
00271         Callback<T(T, T)> func(obj, method);
00272         T result = func((1 << 0), (1 << 1));
00273         TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1));
00274     }
00275 
00276     static void verify3(Callback<T(T, T, T)> func) {
00277         T result = func((1 << 0), (1 << 1), (1 << 2));
00278         TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2));
00279     }
00280 
00281     template <typename O, typename M>
00282     static void verify3(O *obj, M method) {
00283         Callback<T(T, T, T)> func(obj, method);
00284         T result = func((1 << 0), (1 << 1), (1 << 2));
00285         TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2));
00286     }
00287 
00288     static void verify4(Callback<T(T, T, T, T)> func) {
00289         T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3));
00290         TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3));
00291     }
00292 
00293     template <typename O, typename M>
00294     static void verify4(O *obj, M method) {
00295         Callback<T(T, T, T, T)> func(obj, method);
00296         T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3));
00297         TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3));
00298     }
00299 
00300     static void verify5(Callback<T(T, T, T, T, T)> func) {
00301         T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4));
00302         TEST_ASSERT_EQUAL(result, 0x00 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));
00303     }
00304 
00305     template <typename O, typename M>
00306     static void verify5(O *obj, M method) {
00307         Callback<T(T, T, T, T, T)> func(obj, method);
00308         T result = func((1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4));
00309         TEST_ASSERT_EQUAL(result, 0x80 | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));
00310     }
00311 };
00312 
00313 
00314 // test dispatch
00315 template <typename T>
00316 void test_dispatch0() {
00317     Thing<T> thing;
00318     Verifier<T>::verify0(static_func0<T>);
00319     Verifier<T>::verify0(&thing, &Thing<T>::member_func0);
00320     Verifier<T>::verify0((const Thing<T>*)&thing, &Thing<T>::const_member_func0);
00321     Verifier<T>::verify0((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func0);
00322     Verifier<T>::verify0((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func0);
00323     Verifier<T>::verify0(&bound_func0<T>, &thing);
00324     Verifier<T>::verify0(&const_bound_func0<T>, (const Thing<T>*)&thing);
00325     Verifier<T>::verify0(&volatile_bound_func0<T>, (volatile Thing<T>*)&thing);
00326     Verifier<T>::verify0(&const_volatile_bound_func0<T>, (const volatile Thing<T>*)&thing);
00327     Verifier<T>::verify0(&void_func0<T>, &thing);
00328     Verifier<T>::verify0(&const_void_func0<T>, (const Thing<T>*)&thing);
00329     Verifier<T>::verify0(&volatile_void_func0<T>, (volatile Thing<T>*)&thing);
00330     Verifier<T>::verify0(&const_volatile_void_func0<T>, (const volatile Thing<T>*)&thing);
00331     Verifier<T>::verify0(callback(static_func0<T>));
00332 
00333     Callback<T()> cb(static_func0);
00334     Verifier<T>::verify0(cb);
00335     cb = static_func0;
00336     Verifier<T>::verify0(cb);
00337     cb.attach(&bound_func0<T>, &thing);
00338     Verifier<T>::verify0(&cb, &Callback<T()>::call);
00339     Verifier<T>::verify0(&Callback<T()>::thunk, (void*)&cb);
00340 }
00341 
00342 template <typename T>
00343 void test_dispatch1() {
00344     Thing<T> thing;
00345     Verifier<T>::verify1(static_func1<T>);
00346     Verifier<T>::verify1(&thing, &Thing<T>::member_func1);
00347     Verifier<T>::verify1((const Thing<T>*)&thing, &Thing<T>::const_member_func1);
00348     Verifier<T>::verify1((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func1);
00349     Verifier<T>::verify1((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func1);
00350     Verifier<T>::verify1(&bound_func1<T>, &thing);
00351     Verifier<T>::verify1(&const_bound_func1<T>, (const Thing<T>*)&thing);
00352     Verifier<T>::verify1(&volatile_bound_func1<T>, (volatile Thing<T>*)&thing);
00353     Verifier<T>::verify1(&const_volatile_bound_func1<T>, (const volatile Thing<T>*)&thing);
00354     Verifier<T>::verify1(&void_func1<T>, &thing);
00355     Verifier<T>::verify1(&const_void_func1<T>, (const Thing<T>*)&thing);
00356     Verifier<T>::verify1(&volatile_void_func1<T>, (volatile Thing<T>*)&thing);
00357     Verifier<T>::verify1(&const_volatile_void_func1<T>, (const volatile Thing<T>*)&thing);
00358     Verifier<T>::verify1(callback(static_func1<T>));
00359 
00360     Callback<T(T)> cb(static_func1);
00361     Verifier<T>::verify1(cb);
00362     cb = static_func1;
00363     Verifier<T>::verify1(cb);
00364     cb.attach(&bound_func1<T>, &thing);
00365     Verifier<T>::verify1(&cb, &Callback<T(T)>::call);
00366     Verifier<T>::verify1(&Callback<T(T)>::thunk, (void*)&cb);
00367 }
00368 
00369 template <typename T>
00370 void test_dispatch2() {
00371     Thing<T> thing;
00372     Verifier<T>::verify2(static_func2<T>);
00373     Verifier<T>::verify2(&thing, &Thing<T>::member_func2);
00374     Verifier<T>::verify2((const Thing<T>*)&thing, &Thing<T>::const_member_func2);
00375     Verifier<T>::verify2((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func2);
00376     Verifier<T>::verify2((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func2);
00377     Verifier<T>::verify2(&bound_func2<T>, &thing);
00378     Verifier<T>::verify2(&const_bound_func2<T>, (const Thing<T>*)&thing);
00379     Verifier<T>::verify2(&volatile_bound_func2<T>, (volatile Thing<T>*)&thing);
00380     Verifier<T>::verify2(&const_volatile_bound_func2<T>, (const volatile Thing<T>*)&thing);
00381     Verifier<T>::verify2(&void_func2<T>, &thing);
00382     Verifier<T>::verify2(&const_void_func2<T>, (const Thing<T>*)&thing);
00383     Verifier<T>::verify2(&volatile_void_func2<T>, (volatile Thing<T>*)&thing);
00384     Verifier<T>::verify2(&const_volatile_void_func2<T>, (const volatile Thing<T>*)&thing);
00385     Verifier<T>::verify2(callback(static_func2<T>));
00386 
00387     Callback<T(T, T)> cb(static_func2);
00388     Verifier<T>::verify2(cb);
00389     cb = static_func2;
00390     Verifier<T>::verify2(cb);
00391     cb.attach(&bound_func2<T>, &thing);
00392     Verifier<T>::verify2(&cb, &Callback<T(T, T)>::call);
00393     Verifier<T>::verify2(&Callback<T(T, T)>::thunk, (void*)&cb);
00394 }
00395 
00396 template <typename T>
00397 void test_dispatch3() {
00398     Thing<T> thing;
00399     Verifier<T>::verify3(static_func3<T>);
00400     Verifier<T>::verify3(&thing, &Thing<T>::member_func3);
00401     Verifier<T>::verify3((const Thing<T>*)&thing, &Thing<T>::const_member_func3);
00402     Verifier<T>::verify3((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func3);
00403     Verifier<T>::verify3((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func3);
00404     Verifier<T>::verify3(&bound_func3<T>, &thing);
00405     Verifier<T>::verify3(&const_bound_func3<T>, (const Thing<T>*)&thing);
00406     Verifier<T>::verify3(&volatile_bound_func3<T>, (volatile Thing<T>*)&thing);
00407     Verifier<T>::verify3(&const_volatile_bound_func3<T>, (const volatile Thing<T>*)&thing);
00408     Verifier<T>::verify3(&void_func3<T>, &thing);
00409     Verifier<T>::verify3(&const_void_func3<T>, (const Thing<T>*)&thing);
00410     Verifier<T>::verify3(&volatile_void_func3<T>, (volatile Thing<T>*)&thing);
00411     Verifier<T>::verify3(&const_volatile_void_func3<T>, (const volatile Thing<T>*)&thing);
00412     Verifier<T>::verify3(callback(static_func3<T>));
00413 
00414     Callback<T(T, T, T)> cb(static_func3);
00415     Verifier<T>::verify3(cb);
00416     cb = static_func3;
00417     Verifier<T>::verify3(cb);
00418     cb.attach(&bound_func3<T>, &thing);
00419     Verifier<T>::verify3(&cb, &Callback<T(T, T, T)>::call);
00420     Verifier<T>::verify3(&Callback<T(T, T, T)>::thunk, (void*)&cb);
00421 }
00422 
00423 template <typename T>
00424 void test_dispatch4() {
00425     Thing<T> thing;
00426     Verifier<T>::verify4(static_func4<T>);
00427     Verifier<T>::verify4(&thing, &Thing<T>::member_func4);
00428     Verifier<T>::verify4((const Thing<T>*)&thing, &Thing<T>::const_member_func4);
00429     Verifier<T>::verify4((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func4);
00430     Verifier<T>::verify4((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func4);
00431     Verifier<T>::verify4(&bound_func4<T>, &thing);
00432     Verifier<T>::verify4(&const_bound_func4<T>, (const Thing<T>*)&thing);
00433     Verifier<T>::verify4(&volatile_bound_func4<T>, (volatile Thing<T>*)&thing);
00434     Verifier<T>::verify4(&const_volatile_bound_func4<T>, (const volatile Thing<T>*)&thing);
00435     Verifier<T>::verify4(&void_func4<T>, &thing);
00436     Verifier<T>::verify4(&const_void_func4<T>, (const Thing<T>*)&thing);
00437     Verifier<T>::verify4(&volatile_void_func4<T>, (volatile Thing<T>*)&thing);
00438     Verifier<T>::verify4(&const_volatile_void_func4<T>, (const volatile Thing<T>*)&thing);
00439     Verifier<T>::verify4(callback(static_func4<T>));
00440 
00441     Callback<T(T, T, T, T)> cb(static_func4);
00442     Verifier<T>::verify4(cb);
00443     cb = static_func4;
00444     Verifier<T>::verify4(cb);
00445     cb.attach(&bound_func4<T>, &thing);
00446     Verifier<T>::verify4(&cb, &Callback<T(T, T, T, T)>::call);
00447     Verifier<T>::verify4(&Callback<T(T, T, T, T)>::thunk, (void*)&cb);
00448 }
00449 
00450 template <typename T>
00451 void test_dispatch5() {
00452     Thing<T> thing;
00453     Verifier<T>::verify5(static_func5<T>);
00454     Verifier<T>::verify5(&thing, &Thing<T>::member_func5);
00455     Verifier<T>::verify5((const Thing<T>*)&thing, &Thing<T>::const_member_func5);
00456     Verifier<T>::verify5((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func5);
00457     Verifier<T>::verify5((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func5);
00458     Verifier<T>::verify5(&bound_func5<T>, &thing);
00459     Verifier<T>::verify5(&const_bound_func5<T>, (const Thing<T>*)&thing);
00460     Verifier<T>::verify5(&volatile_bound_func5<T>, (volatile Thing<T>*)&thing);
00461     Verifier<T>::verify5(&const_volatile_bound_func5<T>, (const volatile Thing<T>*)&thing);
00462     Verifier<T>::verify5(&void_func5<T>, &thing);
00463     Verifier<T>::verify5(&const_void_func5<T>, (const Thing<T>*)&thing);
00464     Verifier<T>::verify5(&volatile_void_func5<T>, (volatile Thing<T>*)&thing);
00465     Verifier<T>::verify5(&const_volatile_void_func5<T>, (const volatile Thing<T>*)&thing);
00466     Verifier<T>::verify5(callback(static_func5<T>));
00467 
00468     Callback<T(T, T, T, T, T)> cb(static_func5);
00469     Verifier<T>::verify5(cb);
00470     cb = static_func5;
00471     Verifier<T>::verify5(cb);
00472     cb.attach(&bound_func5<T>, &thing);
00473     Verifier<T>::verify5(&cb, &Callback<T(T, T, T, T, T)>::call);
00474     Verifier<T>::verify5(&Callback<T(T, T, T, T, T)>::thunk, (void*)&cb);
00475 }
00476 
00477 
00478 // Test setup
00479 utest::v1::status_t  test_setup(const size_t number_of_cases) {
00480     GREENTEA_SETUP(10, "default_auto");
00481     return verbose_test_setup_handler(number_of_cases);
00482 }
00483 
00484 Case cases[] = {
00485     Case("Testing callbacks with 0 ints", test_dispatch0<int>),
00486     Case("Testing callbacks with 1 ints", test_dispatch1<int>),
00487     Case("Testing callbacks with 2 ints", test_dispatch2<int>),
00488     Case("Testing callbacks with 3 ints", test_dispatch3<int>),
00489     Case("Testing callbacks with 4 ints", test_dispatch4<int>),
00490     Case("Testing callbacks with 5 ints", test_dispatch5<int>),
00491 };
00492 
00493 Specification specification(test_setup, cases);
00494 
00495 int main() {
00496     return !Harness::run(specification);
00497 }