summaryrefslogblamecommitdiff
path: root/test.cc
blob: 00990b6990aa05dacab097c83fa9fe6d0835207a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                  
                  
                 



                      
 

                      

















                                                                                         

                                                                                 
 

                                                                                           
 

                                                                                           
 



                                                                                           
                


























































































                                                                                                                       
 
#include <climits>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <zp/mth>
#include <zp/mem>
#include <zp/str>

int main() {
	[] consteval {
		static_assert(::zp::isptr<int>                                 == false);
		static_assert(::zp::isptr<int                *>                == true);
		static_assert(::zp::isptr<int const          *>                == true);
		static_assert(::zp::isptr<int volatile       *>                == true);
		static_assert(::zp::isptr<int const volatile *>                == true);
		static_assert(::zp::isptr<int                * const>          == true);
		static_assert(::zp::isptr<int const          * const>          == true);
		static_assert(::zp::isptr<int volatile       * const>          == true);
		static_assert(::zp::isptr<int const volatile * const>          == true);
		static_assert(::zp::isptr<int                * volatile>       == true);
		static_assert(::zp::isptr<int const          * volatile>       == true);
		static_assert(::zp::isptr<int volatile       * volatile>       == true);
		static_assert(::zp::isptr<int const volatile * volatile>       == true);
		static_assert(::zp::isptr<int                * const volatile> == true);
		static_assert(::zp::isptr<int const          * const volatile> == true);
		static_assert(::zp::isptr<int volatile       * const volatile> == true);
		static_assert(::zp::isptr<int const volatile * const volatile> == true);

		static_assert(::zp::typequ<::zp::sgn<int>,         int> == true);
		static_assert(::zp::typequ<::zp::sgn<int unsigned>,int> == true);

		static_assert(::zp::typequ<::zp::usgn<int unsigned>,int unsigned> == true);
		static_assert(::zp::typequ<::zp::usgn<int>,         int unsigned> == true);

		static_assert(::zp::typequ<::zp::remqual<int volatile>,      int> == true);
		static_assert(::zp::typequ<::zp::remqual<int const volatile>,int> == true);

		static_assert(::zp::typequ<::zp::remqual<int>,               int> == true);
		static_assert(::zp::typequ<::zp::remqual<int const>,         int> == true);
		static_assert(::zp::typequ<::zp::remqual<int volatile>,      int> == true);
		static_assert(::zp::typequ<::zp::remqual<int const volatile>,int> == true);
		
		static_assert(::zp::typequ<::zp::nulptrtyp,::std::nullptr_t> == true);

		static_assert(::zp::typequ<::zp::i8m,  ::std::uint_least8_t>  == true);
		static_assert(::zp::typequ<::zp::i8ms, ::std::int_least8_t>   == true);
		static_assert(::zp::typequ<::zp::i01m, ::std::uint_least16_t> == true);
		static_assert(::zp::typequ<::zp::i01ms,::std::int_least16_t>  == true);
		static_assert(::zp::typequ<::zp::i02m, ::std::uint_least32_t> == true);
		static_assert(::zp::typequ<::zp::i02ms,::std::int_least32_t>  == true);
		static_assert(::zp::typequ<::zp::i04m, ::std::uint_least64_t> == true);
		static_assert(::zp::typequ<::zp::i04ms,::std::int_least64_t>  == true);

		static_assert(::zp::typequ<::zp::intptr,::std::uintptr_t> == true);
		static_assert(::zp::typequ<::zp::sz,    ::std::size_t>    == true);

		static_assert(::zp::isusgn<char>               == ::std::is_unsigned_v<char>);
		static_assert(::zp::isusgn<char16_t>           == ::std::is_unsigned_v<char16_t>);
		static_assert(::zp::isusgn<char32_t>           == ::std::is_unsigned_v<char32_t>);
		static_assert(::zp::isusgn<char8_t>            == ::std::is_unsigned_v<char8_t>);
		static_assert(::zp::isusgn<double>             == ::std::is_unsigned_v<double>);
		static_assert(::zp::isusgn<float>              == ::std::is_unsigned_v<float>);
		static_assert(::zp::isusgn<int>                == ::std::is_unsigned_v<int>);
		static_assert(::zp::isusgn<long>               == ::std::is_unsigned_v<long>);
		static_assert(::zp::isusgn<long double>        == ::std::is_unsigned_v<long double>);
		static_assert(::zp::isusgn<long long>          == ::std::is_unsigned_v<long long>);
		static_assert(::zp::isusgn<short>              == ::std::is_unsigned_v<short>);
		static_assert(::zp::isusgn<char signed>        == ::std::is_unsigned_v<char signed>);
		static_assert(::zp::isusgn<char unsigned>      == ::std::is_unsigned_v<char unsigned>);
		static_assert(::zp::isusgn<int unsigned>       == ::std::is_unsigned_v<int unsigned>);
		static_assert(::zp::isusgn<long unsigned>      == ::std::is_unsigned_v<long unsigned>);
		static_assert(::zp::isusgn<long long unsigned> == ::std::is_unsigned_v<long long unsigned>);
		static_assert(::zp::isusgn<short unsigned>     == ::std::is_unsigned_v<short unsigned>);
		static_assert(::zp::isusgn<wchar_t>            == ::std::is_unsigned_v<wchar_t>);		

		static_assert(::zp::issgn<char>               == ::std::is_signed_v<char>);
		static_assert(::zp::issgn<double>             == ::std::is_signed_v<double>);
		static_assert(::zp::issgn<float>              == ::std::is_signed_v<float>);
		static_assert(::zp::issgn<int>                == ::std::is_signed_v<int>);
		static_assert(::zp::issgn<long>               == ::std::is_signed_v<long>);
		static_assert(::zp::issgn<long double>        == ::std::is_signed_v<long double>);
		static_assert(::zp::issgn<long long>          == ::std::is_signed_v<long long>);
		static_assert(::zp::issgn<short>              == ::std::is_signed_v<short>);
		static_assert(::zp::issgn<char signed>        == ::std::is_signed_v<char signed>);
		static_assert(::zp::issgn<char unsigned>      == ::std::is_signed_v<char unsigned>);
		static_assert(::zp::issgn<int unsigned>       == ::std::is_signed_v<int unsigned>);
		static_assert(::zp::issgn<long unsigned>      == ::std::is_signed_v<long unsigned>);
		static_assert(::zp::issgn<long long unsigned> == ::std::is_signed_v<long long unsigned>);
		static_assert(::zp::issgn<short unsigned>     == ::std::is_signed_v<short unsigned>);
		static_assert(::zp::issgn<wchar_t>            == ::std::is_signed_v<wchar_t>);

		static_assert(::zp::bytelen == CHAR_BIT);

		static_assert(::zp::minval<bool>               == ::std::numeric_limits<bool>::lowest());
		static_assert(::zp::minval<char>               == ::std::numeric_limits<char>::lowest());
		static_assert(::zp::minval<char16_t>           == ::std::numeric_limits<char16_t>::lowest());
		static_assert(::zp::minval<char32_t>           == ::std::numeric_limits<char32_t>::lowest());
		static_assert(::zp::minval<char8_t>            == ::std::numeric_limits<char8_t>::lowest());
		static_assert(::zp::minval<double>             == ::std::numeric_limits<double>::lowest());
		static_assert(::zp::minval<float>              == ::std::numeric_limits<float>::lowest());
		static_assert(::zp::minval<int>                == ::std::numeric_limits<int>::lowest());
		static_assert(::zp::minval<long>               == ::std::numeric_limits<long>::lowest());
		static_assert(::zp::minval<long double>        == ::std::numeric_limits<long double>::lowest());
		static_assert(::zp::minval<long long>          == ::std::numeric_limits<long long>::lowest());
		static_assert(::zp::minval<short>              == ::std::numeric_limits<short>::lowest());
		static_assert(::zp::minval<char signed>        == ::std::numeric_limits<char signed>::lowest());
		static_assert(::zp::minval<char unsigned>      == ::std::numeric_limits<char unsigned>::lowest());
		static_assert(::zp::minval<short unsigned>     == ::std::numeric_limits<short unsigned>::lowest());
		static_assert(::zp::minval<int unsigned>       == ::std::numeric_limits<int unsigned>::lowest());
		static_assert(::zp::minval<long unsigned>      == ::std::numeric_limits<long unsigned>::lowest());
		static_assert(::zp::minval<long long unsigned> == ::std::numeric_limits<long long unsigned>::lowest());
		static_assert(::zp::minval<wchar_t>            == ::std::numeric_limits<wchar_t>::lowest());

		static_assert(::zp::maxval<bool>               == ::std::numeric_limits<bool>::max());
		static_assert(::zp::maxval<char>               == ::std::numeric_limits<char>::max());
		static_assert(::zp::maxval<char16_t>           == ::std::numeric_limits<char16_t>::max());
		static_assert(::zp::maxval<char32_t>           == ::std::numeric_limits<char32_t>::max());
		static_assert(::zp::maxval<char8_t>            == ::std::numeric_limits<char8_t>::max());
		static_assert(::zp::maxval<double>             == ::std::numeric_limits<double>::max());
		static_assert(::zp::maxval<float>              == ::std::numeric_limits<float>::max());
		static_assert(::zp::maxval<int>                == ::std::numeric_limits<int>::max());
		static_assert(::zp::maxval<long>               == ::std::numeric_limits<long>::max());
		static_assert(::zp::maxval<long double>        == ::std::numeric_limits<long double>::max());
		static_assert(::zp::maxval<long long>          == ::std::numeric_limits<long long>::max());
		static_assert(::zp::maxval<short>              == ::std::numeric_limits<short>::max());
		static_assert(::zp::maxval<char signed>        == ::std::numeric_limits<char signed>::max());
		static_assert(::zp::maxval<char unsigned>      == ::std::numeric_limits<char unsigned>::max());
		static_assert(::zp::maxval<short unsigned>     == ::std::numeric_limits<short unsigned>::max());
		static_assert(::zp::maxval<int unsigned>       == ::std::numeric_limits<int unsigned>::max());
		static_assert(::zp::maxval<long unsigned>      == ::std::numeric_limits<long unsigned>::max());
		static_assert(::zp::maxval<long long unsigned> == ::std::numeric_limits<long long unsigned>::max());
		static_assert(::zp::maxval<wchar_t>            == ::std::numeric_limits<wchar_t>::max());
	}();
}