Skip to content

Commit 7635e76

Browse files
committed
Move test support types to test_types.
1 parent 6a83827 commit 7635e76

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

src/Beman/Optional26/tests/optional_constexpr.t.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,6 @@ TEST(OptionalConstexprTest, Nullopt) {
268268
EXPECT_TRUE(!std::is_default_constructible<beman::optional26::nullopt_t>::value);
269269
}
270270

271-
struct move_detector {
272-
move_detector() = default;
273-
move_detector(move_detector&& rhs) { rhs.been_moved = true; }
274-
bool been_moved = false;
275-
};
276271

277272
TEST(OptionalConstexprTest, Observers) {
278273
constexpr beman::optional26::optional<int> o1 = 42;
@@ -292,19 +287,6 @@ TEST(OptionalConstexprTest, Observers) {
292287

293288
}
294289

295-
namespace {
296-
class Point
297-
{
298-
int x_;
299-
int y_;
300-
public:
301-
constexpr Point() : x_(0), y_(0) {}
302-
constexpr Point(int x, int y) : x_(x), y_(y) {}
303-
auto operator<=>(const Point&) const = default;
304-
bool operator==(const Point&) const = default;
305-
};
306-
307-
}
308290
TEST(OptionalConstexprTest, RelationalOps) {
309291
constexpr beman::optional26::optional<int> o1{4};
310292
constexpr beman::optional26::optional<int> o2{42};
@@ -389,6 +371,8 @@ TEST(OptionalConstexprTest, RelationalOps) {
389371
}
390372
}
391373

374+
using beman::optional26::tests::Point;
375+
392376
constexpr Point p4{2, 3};
393377
constexpr Point p5{3, 4};
394378

@@ -796,6 +780,8 @@ consteval bool testComparisons() {
796780
}
797781
}
798782

783+
using beman::optional26::tests::Point;
784+
799785
constexpr Point p4{2, 3};
800786
constexpr Point p5{3, 4};
801787

src/Beman/Optional26/tests/optional_ref.t.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,6 @@ TEST(OptionalRefTest, Nullopt) {
405405
EXPECT_TRUE(!std::is_default_constructible<beman::optional26::nullopt_t>::value);
406406
}
407407

408-
struct move_detector {
409-
move_detector() = default;
410-
move_detector(move_detector&& rhs) { rhs.been_moved = true; }
411-
bool been_moved = false;
412-
};
413-
414408
TEST(OptionalRefTest, Observers) {
415409
int var = 42;
416410
beman::optional26::optional<int&> o1 = var;

src/Beman/Optional26/tests/test_types.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ struct derived : public base {
4949
auto operator<=>(const derived&) const = default;
5050
};
5151

52+
struct move_detector {
53+
move_detector() = default;
54+
move_detector(move_detector&& rhs) { rhs.been_moved = true; }
55+
bool been_moved = false;
56+
};
57+
58+
class Point {
59+
int x_;
60+
int y_;
61+
62+
public:
63+
constexpr Point() : x_(0), y_(0) {}
64+
constexpr Point(int x, int y) : x_(x), y_(y) {}
65+
auto operator<=>(const Point&) const = default;
66+
bool operator==(const Point&) const = default;
67+
};
68+
5269
} // namespace beman::optional26::tests
5370

5471
#endif // BEMAN_OPTIONAL26_TESTS_TEST_TYPES_HPP

0 commit comments

Comments
 (0)