|
8 | 8 |
|
9 | 9 | #include <boost/test/unit_test.hpp> |
10 | 10 |
|
| 11 | +using namespace std::string_literals; |
| 12 | + |
11 | 13 | BOOST_FIXTURE_TEST_SUITE(streams_tests, BasicTestingSetup) |
12 | 14 |
|
13 | 15 | BOOST_AUTO_TEST_CASE(streams_vector_writer) |
@@ -162,46 +164,34 @@ BOOST_AUTO_TEST_CASE(bitstream_reader_writer) |
162 | 164 | BOOST_AUTO_TEST_CASE(streams_serializedata_xor) |
163 | 165 | { |
164 | 166 | std::vector<std::byte> in; |
165 | | - std::vector<char> expected_xor; |
166 | 167 | CDataStream ds(in, 0, 0); |
167 | 168 |
|
168 | 169 | // Degenerate case |
169 | 170 | ds.Xor({0x00, 0x00}); |
170 | | - BOOST_CHECK_EQUAL( |
171 | | - std::string(expected_xor.begin(), expected_xor.end()), |
172 | | - ds.str()); |
| 171 | + BOOST_CHECK_EQUAL(""s, ds.str()); |
173 | 172 |
|
174 | 173 | in.push_back(std::byte{0x0f}); |
175 | 174 | in.push_back(std::byte{0xf0}); |
176 | | - expected_xor.push_back('\xf0'); |
177 | | - expected_xor.push_back('\x0f'); |
178 | 175 |
|
179 | 176 | // Single character key |
180 | 177 |
|
181 | 178 | ds.clear(); |
182 | 179 | ds.insert(ds.begin(), in.begin(), in.end()); |
183 | 180 |
|
184 | 181 | ds.Xor({0xff}); |
185 | | - BOOST_CHECK_EQUAL( |
186 | | - std::string(expected_xor.begin(), expected_xor.end()), |
187 | | - ds.str()); |
| 182 | + BOOST_CHECK_EQUAL("\xf0\x0f"s, ds.str()); |
188 | 183 |
|
189 | 184 | // Multi character key |
190 | 185 |
|
191 | 186 | in.clear(); |
192 | | - expected_xor.clear(); |
193 | 187 | in.push_back(std::byte{0xf0}); |
194 | 188 | in.push_back(std::byte{0x0f}); |
195 | | - expected_xor.push_back('\x0f'); |
196 | | - expected_xor.push_back('\x00'); |
197 | 189 |
|
198 | 190 | ds.clear(); |
199 | 191 | ds.insert(ds.begin(), in.begin(), in.end()); |
200 | 192 |
|
201 | 193 | ds.Xor({0xff, 0x0f}); |
202 | | - BOOST_CHECK_EQUAL( |
203 | | - std::string(expected_xor.begin(), expected_xor.end()), |
204 | | - ds.str()); |
| 194 | + BOOST_CHECK_EQUAL("\x0f\x00"s, ds.str()); |
205 | 195 | } |
206 | 196 |
|
207 | 197 | BOOST_AUTO_TEST_CASE(streams_buffered_file) |
|
0 commit comments