| 181 | } |
| 182 | |
| 183 | static SC::Result decompressForTest(SC::ZLibStream::Algorithm algorithm, SC::Span<const char> input, |
| 184 | SC::Span<char>& decoded) |
| 185 | { |
| 186 | SC::ZLibStream stream; |
| 187 | SC_TRY(stream.init(algorithm)); |
| 188 | |
| 189 | static char outputStorage[512]; |
| 190 | SC::Span<char> remaining = outputStorage; |
| 191 | SC_TRY(stream.process(input, remaining)); |
| 192 | SC_TRY_MSG(input.empty(), "HttpAsyncClientTest compressed fixture output too small"); |
| 193 | |
| 194 | bool streamEnded = false; |
| 195 | SC_TRY(stream.finalize(remaining, streamEnded)); |
| 196 | SC_TRY_MSG(streamEnded, "HttpAsyncClientTest compressed fixture did not end"); |
| 197 | decoded = {outputStorage, sizeof(outputStorage) - remaining.sizeInBytes()}; |
| 198 | return SC::Result(true); |
| 199 | } |
| 200 | |
| 201 | static bool resultMessageEquals(SC::Result result, SC::StringSpan expected) |
| 202 | { |