| 11 | #include "fl/stl/unordered_map.h" |
| 12 | |
| 13 | FL_TEST_FILE(FL_FILEPATH) { |
| 14 | |
| 15 | |
| 16 | // Test object that tracks construction/destruction for move semantics testing |
| 17 | struct TrackedObject { |
| 18 | static int construction_count; |
| 19 | static int destruction_count; |
| 20 | static int move_construction_count; |
| 21 | static int copy_construction_count; |
| 22 | |
| 23 | int value; |
| 24 | bool moved_from; |
| 25 | |
| 26 | TrackedObject(int v = 0) : value(v), moved_from(false) { |
| 27 | construction_count++; |
| 28 | } |
| 29 | |
| 30 | TrackedObject(const TrackedObject& other) : value(other.value), moved_from(false) { |
| 31 | copy_construction_count++; |
| 32 | } |
| 33 | |
| 34 | TrackedObject(TrackedObject&& other) noexcept : value(other.value), moved_from(false) { |
| 35 | other.moved_from = true; |
| 36 | move_construction_count++; |
| 37 | } |
| 38 | |
| 39 | TrackedObject& operator=(const TrackedObject& other) { |
| 40 | if (this != &other) { |
| 41 | value = other.value; |
| 42 | moved_from = false; |
| 43 | } |
| 44 | return *this; |
| 45 | } |
| 46 | |
| 47 | TrackedObject& operator=(TrackedObject&& other) noexcept { |
| 48 | if (this != &other) { |
| 49 | value = other.value; |
| 50 | moved_from = false; |
| 51 | other.moved_from = true; |
| 52 | } |
| 53 | return *this; |
| 54 | } |
| 55 | |
| 56 | ~TrackedObject() { |
| 57 | destruction_count++; |
| 58 | } |
| 59 | |
| 60 | static void reset_counters() { |
| 61 | construction_count = 0; |
| 62 | destruction_count = 0; |
| 63 | move_construction_count = 0; |
| 64 | copy_construction_count = 0; |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | // Static member definitions |
| 69 | int TrackedObject::construction_count = 0; |
| 70 | int TrackedObject::destruction_count = 0; |
nothing calls this directly
no test coverage detected