[libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -137,7 +137,7 @@ int main()
|
||||
// LWG#2837
|
||||
{
|
||||
auto res1 = std::lcm(static_cast<std::int64_t>(1234), INT32_MIN);
|
||||
(void)std::lcm(INT_MIN, 2UL); // this used to trigger UBSAN
|
||||
(void)std::lcm(INT_MIN, 2UL); // this used to trigger UBSAN
|
||||
static_assert(std::is_same_v<decltype(res1), std::int64_t>, "");
|
||||
assert(res1 == 1324997410816LL);
|
||||
}
|
||||
|
||||
@@ -65,10 +65,10 @@ int main()
|
||||
test<random_access_iterator<const int*> >();
|
||||
test<const int*>();
|
||||
|
||||
// Make sure the math is done using the correct type
|
||||
// Make sure the math is done using the correct type
|
||||
{
|
||||
auto v = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
unsigned res = std::reduce(v.begin(), v.end(), 1U, std::multiplies<>());
|
||||
assert(res == 40320); // 8! will not fit into a char
|
||||
assert(res == 40320); // 8! will not fit into a char
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ void basic_tests()
|
||||
std::vector<int> v(10);
|
||||
std::fill(v.begin(), v.end(), 3);
|
||||
std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), identity<>());
|
||||
std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
|
||||
std::cout << std::endl;
|
||||
std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
|
||||
std::cout << std::endl;
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
assert(v[i] == (int)(i+1) * 3);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ struct identity<void>
|
||||
template <class _Tp = void>
|
||||
struct twice
|
||||
{
|
||||
constexpr const _Tp operator()(const _Tp& __x) const noexcept { return 2 * __x; }
|
||||
constexpr const _Tp operator()(const _Tp& __x) const noexcept { return 2 * __x; }
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -115,10 +115,10 @@ int main()
|
||||
test<const int*>();
|
||||
test< int*>();
|
||||
|
||||
// Make sure the math is done using the correct type
|
||||
// Make sure the math is done using the correct type
|
||||
{
|
||||
auto v = {1, 2, 3, 4, 5, 6};
|
||||
unsigned res = std::transform_reduce(v.begin(), v.end(), 1U, std::multiplies<>(), twice<>());
|
||||
assert(res == 46080); // 6! * 64 will not fit into a char
|
||||
assert(res == 46080); // 6! * 64 will not fit into a char
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user