================ @@ -0,0 +1,157 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 + +// <numeric> + +// template<class R, class T> +// constexpr R saturate_cast(T x) noexcept; // freestanding + +#include <cassert> +#include <concepts> +#include <limits> +#include <numeric> + +template <typename IntegerResultT, typename IntegerT> ---------------- mordante wrote:
I'm not fond of this test. IMO it's a bit too smart and it makes it hard to understand what is tested. What I often do for these kind of tests is something like ``` assert(std::saturate_cast<signed char, int>(-255) == -128); assert(std::saturate_cast<signed char, int>(-128) == -128); assert(std::saturate_cast<signed char, int>(0) == 0); assert(std::saturate_cast<signed char, int>(127) == 127); assert(std::saturate_cast<signed char, int>(255) == 127); ``` and similar for other conversions. I think that is easier to follow. (Note I like the add, sub, mul, and div test.) https://github.com/llvm/llvm-project/pull/77967 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits