[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / language.support / support.limits / limits / numeric.limits.members / min.pass.cpp
blob09877362447bca04c54441be65c0093f041d4ea3
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // test numeric_limits
11 // min()
13 #include <limits>
14 #include <climits>
15 #include <cfloat>
16 #include <cassert>
18 #include "test_macros.h"
20 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
21 # include <cwchar>
22 #endif
24 template <class T>
25 void
26 test(T expected)
28 assert(std::numeric_limits<T>::min() == expected);
29 assert(std::numeric_limits<T>::is_bounded || !std::numeric_limits<T>::is_signed);
30 assert(std::numeric_limits<const T>::min() == expected);
31 assert(std::numeric_limits<const T>::is_bounded || !std::numeric_limits<const T>::is_signed);
32 assert(std::numeric_limits<volatile T>::min() == expected);
33 assert(std::numeric_limits<volatile T>::is_bounded || !std::numeric_limits<volatile T>::is_signed);
34 assert(std::numeric_limits<const volatile T>::min() == expected);
35 assert(std::numeric_limits<const volatile T>::is_bounded || !std::numeric_limits<const volatile T>::is_signed);
38 int main(int, char**)
40 test<bool>(false);
41 test<char>(CHAR_MIN);
42 test<signed char>(SCHAR_MIN);
43 test<unsigned char>(0);
44 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
45 test<wchar_t>(WCHAR_MIN);
46 #endif
47 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
48 test<char8_t>(0);
49 #endif
50 test<char16_t>(0);
51 test<char32_t>(0);
52 test<short>(SHRT_MIN);
53 test<unsigned short>(0);
54 test<int>(INT_MIN);
55 test<unsigned int>(0);
56 test<long>(LONG_MIN);
57 test<unsigned long>(0);
58 test<long long>(LLONG_MIN);
59 test<unsigned long long>(0);
60 #ifndef TEST_HAS_NO_INT128
61 test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
62 test<__uint128_t>(0);
63 #endif
64 test<float>(FLT_MIN);
65 test<double>(DBL_MIN);
66 test<long double>(LDBL_MIN);
68 return 0;