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

Function FL_TEST_FILE

tests/fl/stl/pair.cpp:7–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "fl/stl/static_assert.h"
6
7FL_TEST_FILE(FL_FILEPATH) {
8
9using namespace fl;
10
11namespace {
12
13// Helper class to test move semantics
14struct MoveTestTypePair {
15 int value;
16 bool moved_from = false;
17 bool moved_to = false;
18
19 MoveTestTypePair() : value(0) {}
20 explicit MoveTestTypePair(int v) : value(v) {}
21
22 // Copy constructor
23 MoveTestTypePair(const MoveTestTypePair& other) : value(other.value) {}
24
25 // Move constructor
26 MoveTestTypePair(MoveTestTypePair&& other) noexcept
27 : value(other.value), moved_to(true) {
28 other.moved_from = true;
29 other.value = 0;
30 }
31
32 // Copy assignment
33 MoveTestTypePair& operator=(const MoveTestTypePair& other) {
34 value = other.value;
35 return *this;
36 }
37
38 // Move assignment
39 MoveTestTypePair& operator=(MoveTestTypePair&& other) noexcept {
40 value = other.value;
41 moved_to = true;
42 other.moved_from = true;
43 other.value = 0;
44 return *this;
45 }
46
47 bool operator==(const MoveTestTypePair& other) const {
48 return value == other.value;
49 }
50
51 bool operator<(const MoveTestTypePair& other) const {
52 return value < other.value;
53 }
54};
55
56} // anonymous namespace
57
58FL_TEST_CASE("fl::pair default constructor") {
59 FL_SUBCASE("pair with default constructible types") {
60 pair<int, double> p;
61 FL_CHECK_EQ(p.first, 0);
62 FL_CHECK_EQ(p.second, 0.0);
63 }
64

Callers

nothing calls this directly

Calls 5

MoveTestTypePairClass · 0.85
make_pairFunction · 0.85
ApproxFunction · 0.50
swapFunction · 0.50
swapMethod · 0.45

Tested by

no test coverage detected