//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // test numeric_limits // lowest() #include #include #include #include #include #include "test_macros.h" template void test(T expected) { assert(std::numeric_limits::lowest() == expected); assert(std::numeric_limits::is_bounded); assert(std::numeric_limits::lowest() == expected); assert(std::numeric_limits::is_bounded); assert(std::numeric_limits::lowest() == expected); assert(std::numeric_limits::is_bounded); assert(std::numeric_limits::lowest() == expected); assert(std::numeric_limits::is_bounded); } int main(int, char**) { test(false); test(CHAR_MIN); test(SCHAR_MIN); test(0); test(WCHAR_MIN); #if TEST_STD_VER > 17 && defined(__cpp_char8_t) test(0); #endif #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS test(0); test(0); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS test(SHRT_MIN); test(0); test(INT_MIN); test(0); test(LONG_MIN); test(0); test(LLONG_MIN); test(0); #ifndef _LIBCPP_HAS_NO_INT128 test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1); test<__uint128_t>(0); #endif test(-FLT_MAX); test(-DBL_MAX); test(-LDBL_MAX); return 0; }