diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/hana/test/core/is_embedded.cpp | |
parent | Initial commit. (diff) | |
download | ceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.tar.xz ceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/hana/test/core/is_embedded.cpp')
-rw-r--r-- | src/boost/libs/hana/test/core/is_embedded.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/core/is_embedded.cpp b/src/boost/libs/hana/test/core/is_embedded.cpp new file mode 100644 index 000000000..12a440901 --- /dev/null +++ b/src/boost/libs/hana/test/core/is_embedded.cpp @@ -0,0 +1,62 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#include <boost/hana/core/to.hpp> +#include <boost/hana/equal.hpp> + +#include <climits> +namespace hana = boost::hana; + + +// This test makes sure that fundamental types are properly embedded in +// each other, when sensible. + +static_assert(hana::is_embedded<double, long double>{}, ""); +static_assert(hana::is_embedded<float, long double>{}, ""); +static_assert(hana::is_embedded<float, double>{}, ""); + +static_assert(hana::is_embedded<signed long, signed long long>{}, ""); +static_assert(hana::is_embedded<signed int, signed long long>{}, ""); +static_assert(hana::is_embedded<signed short, signed long long>{}, ""); +static_assert(hana::is_embedded<signed char, signed long long>{}, ""); +static_assert(hana::is_embedded<signed int, signed long>{}, ""); +static_assert(hana::is_embedded<signed short, signed long>{}, ""); +static_assert(hana::is_embedded<signed char, signed long>{}, ""); +static_assert(hana::is_embedded<signed short, signed int>{}, ""); +static_assert(hana::is_embedded<signed char, signed int>{}, ""); +static_assert(hana::is_embedded<signed char, signed short>{}, ""); + +static_assert(hana::is_embedded<unsigned long, unsigned long long>{}, ""); +static_assert(hana::is_embedded<unsigned int, unsigned long long>{}, ""); +static_assert(hana::is_embedded<unsigned short, unsigned long long>{}, ""); +static_assert(hana::is_embedded<unsigned char, unsigned long long>{}, ""); +static_assert(hana::is_embedded<unsigned int, unsigned long>{}, ""); +static_assert(hana::is_embedded<unsigned short, unsigned long>{}, ""); +static_assert(hana::is_embedded<unsigned char, unsigned long>{}, ""); +static_assert(hana::is_embedded<unsigned short, unsigned int>{}, ""); +static_assert(hana::is_embedded<unsigned char, unsigned int>{}, ""); +static_assert(hana::is_embedded<unsigned char, unsigned short>{}, ""); + +#if CHAR_MIN < 0 // char is signed + + static_assert(hana::is_embedded<char, signed long long>{}, ""); + static_assert(hana::is_embedded<char, signed long>{}, ""); + static_assert(hana::is_embedded<char, signed int>{}, ""); + static_assert(hana::is_embedded<char, signed short>{}, ""); + + static_assert(hana::equal('a', static_cast<signed int>('a')), ""); + +#else // char is unsigned + + static_assert(hana::is_embedded<char, unsigned long long>{}, ""); + static_assert(hana::is_embedded<char, unsigned long>{}, ""); + static_assert(hana::is_embedded<char, unsigned int>{}, ""); + static_assert(hana::is_embedded<char, unsigned short>{}, ""); + + static_assert(hana::equal('a', static_cast<unsigned int>('a')), ""); + +#endif + + +int main() { } |