| 31 | #include "fl/stl/static_assert.h" |
| 32 | |
| 33 | FL_TEST_FILE(FL_FILEPATH) { |
| 34 | |
| 35 | using namespace fl; |
| 36 | using namespace test_helpers; |
| 37 | |
| 38 | namespace { |
| 39 | |
| 40 | // Helper class to test move semantics |
| 41 | struct MoveTestTypeMove { |
| 42 | int value; |
| 43 | bool moved_from; |
| 44 | bool moved_to; |
| 45 | |
| 46 | MoveTestTypeMove() : value(0), moved_from(false), moved_to(false) {} |
| 47 | explicit MoveTestTypeMove(int v) : value(v), moved_from(false), moved_to(false) {} |
| 48 | |
| 49 | // Copy constructor |
| 50 | MoveTestTypeMove(const MoveTestTypeMove& other) |
| 51 | : value(other.value), moved_from(false), moved_to(false) {} |
| 52 | |
| 53 | // Move constructor |
| 54 | MoveTestTypeMove(MoveTestTypeMove&& other) |
| 55 | : value(other.value), moved_from(false), moved_to(true) { |
| 56 | other.moved_from = true; |
| 57 | other.value = 0; |
| 58 | } |
| 59 | |
| 60 | // Copy assignment |
| 61 | MoveTestTypeMove& operator=(const MoveTestTypeMove& other) { |
| 62 | if (this != &other) { |
| 63 | value = other.value; |
| 64 | moved_from = false; |
| 65 | moved_to = false; |
| 66 | } |
| 67 | return *this; |
| 68 | } |
| 69 | |
| 70 | // Move assignment |
| 71 | MoveTestTypeMove& operator=(MoveTestTypeMove&& other) { |
| 72 | if (this != &other) { |
| 73 | value = other.value; |
| 74 | moved_from = false; |
| 75 | moved_to = true; |
| 76 | other.moved_from = true; |
| 77 | other.value = 0; |
| 78 | } |
| 79 | return *this; |
| 80 | } |
| 81 | }; |
| 82 | |
| 83 | } // anonymous namespace |
| 84 | |
| 85 | FL_TEST_CASE("fl::remove_reference trait") { |
| 86 | FL_SUBCASE("Non-reference types remain unchanged") { |
| 87 | FL_STATIC_ASSERT(fl::is_same<typename remove_reference<int>::type, int>::value, |
| 88 | "remove_reference should not change int"); |
| 89 | FL_STATIC_ASSERT(fl::is_same<typename remove_reference<float>::type, float>::value, |
| 90 | "remove_reference should not change float"); |
nothing calls this directly
no test coverage detected