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

Method testConstruction

test/string.cpp:90–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 }
89
90 void
91 testConstruction()
92 {
93 test_vectors const t;
94
95 // string()
96 {
97 string s;
98 }
99
100 // string(storage_ptr)
101 {
102 auto const sp =
103 make_shared_resource<unique_resource>();
104 string s(sp);
105 BOOST_TEST(s.empty());
106 BOOST_TEST(*s.storage() == *sp.get());
107 }
108
109 // string(size_type, char, storage_ptr)
110 {
111 fail_loop([&](storage_ptr const& sp)
112 {
113 string s(t.v1.size(), '*', sp);
114 BOOST_TEST(s == std::string(t.v1.size(), '*'));
115 });
116
117 {
118 string s(t.v2.size(), '*');
119 BOOST_TEST(s == std::string(t.v2.size(), '*'));
120 }
121 }
122
123 // string(char const*, storage_ptr)
124 {
125 fail_loop([&](storage_ptr const& sp)
126 {
127 string s(t.s1.c_str(), sp);
128 BOOST_TEST(s == t.v1);
129 });
130
131 fail_loop([&](storage_ptr const& sp)
132 {
133 string s(t.s2.c_str(), sp);
134 BOOST_TEST(s == t.v2);
135 });
136
137 {
138 string s(t.s1.c_str());
139 BOOST_TEST(s == t.v1);
140 }
141
142 {
143 string s(t.s2.c_str());
144 BOOST_TEST(s == t.v2);
145 }
146 }
147

Callers

nothing calls this directly

Calls 11

fail_loopFunction · 0.85
make_input_iteratorFunction · 0.85
pilferFunction · 0.85
c_strMethod · 0.80
stringClass · 0.50
storage_ptrClass · 0.50
emptyMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected