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

Method testCapacity

test/beast/core/static_string.cpp:522–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520 }
521
522 void
523 testCapacity()
524 {
525 static_string<3> s;
526 BEAST_EXPECT(s.empty());
527 BEAST_EXPECT(s.size() == 0);
528 BEAST_EXPECT(s.length() == 0);
529 BEAST_EXPECT(s.max_size() == 3);
530 BEAST_EXPECT(s.capacity() == 3);
531 s = "123";
532 BEAST_EXPECT(! s.empty());
533 BEAST_EXPECT(s.size() == 3);
534 BEAST_EXPECT(s.length() == 3);
535 s.reserve(0);
536 s.reserve(3);
537 try
538 {
539 s.reserve(4);
540 fail("", __FILE__, __LINE__);
541 }
542 catch(std::length_error const&)
543 {
544 pass();
545 }
546 s.shrink_to_fit();
547 BEAST_EXPECT(! s.empty());
548 BEAST_EXPECT(s.size() == 3);
549 BEAST_EXPECT(s.length() == 3);
550 BEAST_EXPECT(*s.end() == 0);
551 }
552
553 void
554 testOperations()

Callers

nothing calls this directly

Calls 6

failFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
max_sizeMethod · 0.45
capacityMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected