blob: f58c504a69b3de855f0246b9e85a1f57321965ba [file] [log] [blame]
/// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdint.h>
#include <initializer_list>
#include <fbl/array.h>
#include <src/lib/chunked-compression/chunked-archive.h>
namespace chunked_compression {
namespace test_utils {
// Computes the checksum for a raw archive header.
// |header_length| must be at least kChunkArchiveMinHeaderSize bytes.
uint32_t ComputeChecksum(const uint8_t* header, size_t header_length);
// Serializes a well formed seek table with |entries| to a buffer.
// The seek table invariants are *NOT* checked. This is intentional to catch
// HeaderReader::Parse bugs in the test cases.
fbl::Array<uint8_t> CreateHeader(std::initializer_list<SeekTableEntry> entries);
inline fbl::Array<uint8_t> CreateHeader() { return CreateHeader({}); }
} // namespace test_utils
} // namespace chunked_compression