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

Function FL_TEST_FILE

tests/fl/stl/multi_set.cpp:5–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include "test.h"
4
5FL_TEST_FILE(FL_FILEPATH) {
6
7using namespace fl;
8
9FL_TEST_CASE("fl::multi_set basic operations") {
10 fl::multi_set<int> ms;
11
12 FL_SUBCASE("Empty multiset") {
13 FL_CHECK(ms.empty());
14 FL_CHECK(ms.size() == 0);
15 }
16
17 FL_SUBCASE("Insert single element") {
18 auto it = ms.insert(42);
19 FL_CHECK(ms.size() == 1);
20 FL_CHECK(ms.contains(42));
21 FL_CHECK(*it == 42);
22 }
23
24 FL_SUBCASE("Insert duplicate keys") {
25 ms.insert(5);
26 ms.insert(5);
27 ms.insert(5);
28
29 FL_CHECK(ms.size() == 3);
30 FL_CHECK(ms.count(5) == 3);
31
32 // All values should be findable
33 auto range = ms.equal_range(5);
34 int count = 0;
35 for (auto it = range.first; it != range.second; ++it) {
36 count++;
37 }
38 FL_CHECK(count == 3);
39 }
40
41 FL_SUBCASE("Insert different keys") {
42 ms.insert(1);
43 ms.insert(2);
44 ms.insert(3);
45
46 FL_CHECK(ms.size() == 3);
47 FL_CHECK(ms.count(1) == 1);
48 FL_CHECK(ms.count(2) == 1);
49 FL_CHECK(ms.count(3) == 1);
50 }
51
52 FL_SUBCASE("Find operations") {
53 ms.insert(10);
54 ms.insert(20);
55
56 auto it = ms.find(10);
57 FL_CHECK(it != ms.end());
58 FL_CHECK(*it == 10);
59
60 auto missing = ms.find(999);
61 FL_CHECK(missing == ms.end());
62 }

Callers

nothing calls this directly

Calls 15

emptyMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
containsMethod · 0.45
countMethod · 0.45
equal_rangeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45
lower_boundMethod · 0.45
upper_boundMethod · 0.45

Tested by

no test coverage detected