MCPcopy Create free account
hub / github.com/boostorg/json / testPushPop

Method testPushPop

test/string.cpp:1820–1862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1818 }
1819
1820 void
1821 testPushPop()
1822 {
1823 test_vectors const t;
1824
1825 // push_back(char)
1826 {
1827 fail_loop([&](storage_ptr const& sp)
1828 {
1829 string s(sp);
1830 for(auto ch : t.v1)
1831 s.push_back(ch);
1832 BOOST_TEST(s == t.v1);
1833 });
1834
1835 fail_loop([&](storage_ptr const& sp)
1836 {
1837 string s(sp);
1838 for(auto ch : t.v2)
1839 s.push_back(ch);
1840 BOOST_TEST(s == t.v2);
1841 });
1842 }
1843
1844 // pop_back(char)
1845 {
1846 {
1847 string s(t.v1);
1848 while(! s.empty())
1849 s.pop_back();
1850 BOOST_TEST(s.empty());
1851 BOOST_TEST(s.capacity() > 0);
1852 }
1853
1854 {
1855 string s(t.v2);
1856 while(! s.empty())
1857 s.pop_back();
1858 BOOST_TEST(s.empty());
1859 BOOST_TEST(s.capacity() > 0);
1860 }
1861 }
1862 }
1863
1864 void
1865 testAppend()

Callers

nothing calls this directly

Calls 4

fail_loopFunction · 0.85
push_backMethod · 0.45
emptyMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected