[Olena-patches] 401: Add tests for mlc_is_a, mlc_if and mlc_typedef.

https://svn.lrde.epita.fr/svn/oln/trunk/metalic Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Add tests for mlc_is_a, mlc_if and mlc_typedef. * tests/is_a.cc, tests/if.cc, tests/typedef.cc: New tests. if.cc | 17 +++++++++++++++++ is_a.cc | 14 ++++++++++++++ typedef.cc | 17 +++++++++++++++++ 3 files changed, 48 insertions(+) Index: tests/is_a.cc --- tests/is_a.cc (revision 0) +++ tests/is_a.cc (revision 0) @@ -0,0 +1,14 @@ +#include <mlc/is_a.hh> + +struct A {}; +struct B : public A {}; + +template <class T> struct C {}; +template <class T> struct D : public C<T> {}; + +int +main () +{ + mlc_is_a_(B, A)::ensure(); + mlc_is_a_(D<int>, C<int>)::ensure(); +} Index: tests/if.cc --- tests/if.cc (revision 0) +++ tests/if.cc (revision 0) @@ -0,0 +1,17 @@ +#include <mlc/if.hh> +#include <mlc/cmp.hh> + +struct alpha; +struct beta; +struct gamma; +struct delta; + +int +main() +{ + typedef mlc_if_(mlc::true_, alpha, beta) x; + mlc_eq(x, alpha)::ensure(); + + typedef mlc_if_(mlc::false_, gamma, delta) y; + mlc_eq(y, delta)::ensure(); +} Index: tests/typedef.cc --- tests/typedef.cc (revision 0) +++ tests/typedef.cc (revision 0) @@ -0,0 +1,17 @@ +#include <mlc/typedef.hh> +#include <mlc/cmp.hh> + +struct foo +{ + typedef int good_type; +}; + +mlc_decl_typedef(good_type); +mlc_decl_typedef(bad_type); + +int +main () +{ + mlc_eq(mlc_typedef_(foo, good_type), foo::good_type)::ensure(); + mlc_eq(mlc_typedef_(foo, bad_type), mlc::not_found)::ensure(); +}
participants (1)
-
Roland Levillain