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

Method testAssign

test/beast/core/static_string.cpp:161–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159 }
160
161 void
162 testAssign()
163 {
164 {
165 static_string<3> s1("123");
166 static_string<3> s2;
167 s2 = s1;
168 BEAST_EXPECT(s2 == "123");
169 BEAST_EXPECT(*s2.end() == 0);
170 }
171 {
172 static_string<3> s1("123");
173 static_string<5> s2;
174 s2 = s1;
175 BEAST_EXPECT(s2 == "123");
176 BEAST_EXPECT(*s2.end() == 0);
177 try
178 {
179 static_string<1> s3;
180 s3 = s1;
181 fail("", __FILE__, __LINE__);
182 }
183 catch(std::length_error const&)
184 {
185 pass();
186 }
187 }
188 {
189 static_string<3> s1;
190 s1 = "123";
191 BEAST_EXPECT(s1 == "123");
192 BEAST_EXPECT(*s1.end() == 0);
193 try
194 {
195 static_string<1> s2;
196 s2 = "123";
197 fail("", __FILE__, __LINE__);
198 }
199 catch(std::length_error const&)
200 {
201 pass();
202 }
203 }
204 {
205 static_string<1> s1;
206 s1 = 'x';
207 BEAST_EXPECT(s1 == "x");
208 BEAST_EXPECT(*s1.end() == 0);
209 try
210 {
211 static_string<0> s2;
212 s2 = 'x';
213 fail("", __FILE__, __LINE__);
214 }
215 catch(std::length_error const&)
216 {
217 pass();
218 }

Callers

nothing calls this directly

Calls 4

assignMethod · 0.80
failFunction · 0.50
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected