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

Function FL_TEST_FILE

tests/fl/stl/list.cpp:6–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "fl/stl/move.h"
5
6FL_TEST_FILE(FL_FILEPATH) {
7
8using namespace fl;
9
10FL_TEST_CASE("fl::list - default constructor") {
11 list<int> lst;
12
13 FL_CHECK(lst.empty());
14 FL_CHECK_EQ(lst.size(), 0);
15 FL_CHECK(lst.begin() == lst.end());
16}
17
18FL_TEST_CASE("fl::list - constructor with count and value") {
19 FL_SUBCASE("create with count") {
20 list<int> lst(5, 42);
21
22 FL_CHECK_FALSE(lst.empty());
23 FL_CHECK_EQ(lst.size(), 5);
24
25 for (const auto& val : lst) {
26 FL_CHECK_EQ(val, 42);
27 }
28 }
29
30 FL_SUBCASE("create with zero count") {
31 list<int> lst(0, 10);
32 FL_CHECK(lst.empty());
33 FL_CHECK_EQ(lst.size(), 0);
34 }
35}
36
37FL_TEST_CASE("fl::list - initializer list constructor") {
38 list<int> lst = {1, 2, 3, 4, 5};
39
40 FL_CHECK_EQ(lst.size(), 5);
41 FL_CHECK_EQ(lst.front(), 1);
42 FL_CHECK_EQ(lst.back(), 5);
43
44 auto it = lst.begin();
45 FL_CHECK_EQ(*it++, 1);
46 FL_CHECK_EQ(*it++, 2);
47 FL_CHECK_EQ(*it++, 3);
48 FL_CHECK_EQ(*it++, 4);
49 FL_CHECK_EQ(*it++, 5);
50 FL_CHECK(it == lst.end());
51}
52
53FL_TEST_CASE("fl::list - copy constructor") {
54 list<int> original = {10, 20, 30};
55 list<int> copy(original);
56
57 FL_CHECK_EQ(copy.size(), original.size());
58 FL_CHECK_EQ(copy.front(), original.front());
59 FL_CHECK_EQ(copy.back(), original.back());
60
61 auto it1 = original.begin();
62 auto it2 = copy.begin();
63 while (it1 != original.end()) {

Callers

nothing calls this directly

Calls 15

remove_ifMethod · 0.80
reverseMethod · 0.80
sortMethod · 0.80
spliceMethod · 0.80
TestStructClass · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
frontMethod · 0.45
backMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected