MCPcopy Create free account
hub / github.com/boostorg/beast / testMembers

Method testMembers

test/beast/http/fields.cpp:78–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 }
77
78 void
79 testMembers()
80 {
81 using namespace test;
82
83 // compare equal
84 using equal_t = test::test_allocator<char,
85 true, true, true, true, true>;
86
87 // compare not equal
88 using unequal_t = test::test_allocator<char,
89 false, true, true, true, true>;
90
91 // construction
92 {
93 {
94 fields f;
95 BEAST_EXPECT(f.begin() == f.end());
96 }
97 {
98 unequal_t a1;
99 basic_fields<unequal_t> f{a1};
100 BEAST_EXPECT(f.get_allocator() == a1);
101 BEAST_EXPECT(f.get_allocator() != unequal_t{});
102 }
103 }
104
105 // move construction
106 {
107 {
108 basic_fields<equal_t> f1;
109 BEAST_EXPECT(f1.get_allocator()->nmove == 0);
110 f1.insert("1", "1");
111 BEAST_EXPECT(f1["1"] == "1");
112 basic_fields<equal_t> f2{std::move(f1)};
113 BEAST_EXPECT(f2.get_allocator()->nmove == 1);
114 BEAST_EXPECT(f2["1"] == "1");
115 BEAST_EXPECT(f1["1"] == "");
116 }
117 // allocators equal
118 {
119 basic_fields<equal_t> f1;
120 f1.insert("1", "1");
121 equal_t a;
122 basic_fields<equal_t> f2{std::move(f1), a};
123 BEAST_EXPECT(f2["1"] == "1");
124 BEAST_EXPECT(f1["1"] == "");
125 }
126 {
127 // allocators unequal
128 basic_fields<unequal_t> f1;
129 f1.insert("1", "1");
130 unequal_t a;
131 basic_fields<unequal_t> f2{std::move(f1), a};
132 BEAST_EXPECT(f2["1"] == "1");
133 }
134 }
135

Callers

nothing calls this directly

Calls 7

moveClass · 0.85
idMethod · 0.80
swapFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
get_allocatorMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected