MCPcopy Create free account
hub / github.com/FastLED/FastLED / FL_TEST_FILE

Function FL_TEST_FILE

tests/fl/stl/move.cpp:33–1518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include "fl/stl/static_assert.h"
32
33FL_TEST_FILE(FL_FILEPATH) {
34
35using namespace fl;
36using namespace test_helpers;
37
38namespace {
39
40// Helper class to test move semantics
41struct 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
85FL_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");

Callers

nothing calls this directly

Calls 15

MoveTestTypeMoveClass · 0.85
get_valueFunction · 0.85
make_shared_intFunction · 0.85
populateFunction · 0.85
retrieveFunction · 0.85
populate_mapFunction · 0.85
retrieve_mapFunction · 0.85
expiredMethod · 0.80
use_countMethod · 0.45
pushMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected