// Part of the Carbon Language project, under the Apache License v2.0 with LLVM // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include "common/ostream.h" #include #include #include #include #include #include #include #include #include #include "common/raw_string_ostream.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" namespace Carbon::Testing { namespace { using ::testing::ElementsAre; // Whether two types can be compared with both `==` and `<=>`. template concept Comparable = requires(const LhsT& lhs, const RhsT& rhs) { lhs == rhs; lhs <=> rhs; }; // A child that defaults its comparisons with member declarations. struct Point : Printable { int x; int y; constexpr Point(int x, int y) : x(x), y(y) {} auto Print(llvm::raw_ostream& out) const -> void { out << "(" << x << ", " << y << ")"; } auto operator<=>(const Point& rhs) const = default; }; // A child that defaults its comparisons with friend declarations, and whose // comparisons are neither trivial nor `noexcept`. struct Label : Printable