xref: /openbmc/bmcweb/test/http/zstd_test_arrays.hpp (revision f485bd44a22c27a2346a69d740764ea98b333bd1)
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 
4 #pragma once
5 
6 #include <array>
7 
8 namespace bmcweb
9 {
10 namespace zstd
11 {
12 // A 1MB file of all ones created using
13 // dd if=/dev/zero bs=1024 count=1024 | tr "\000" "\377" > ones-file
14 // zstd -c ones-file | xxd -i
15 constexpr std::array<unsigned char, 54> ones = {
16     0x28, 0xb5, 0x2f, 0xfd, 0xa4, 0x00, 0x00, 0x10, 0x00, 0x54, 0x00,
17     0x00, 0x10, 0xff, 0xff, 0x01, 0x00, 0xfb, 0xff, 0x39, 0xc0, 0x02,
18     0x02, 0x00, 0x10, 0xff, 0x02, 0x00, 0x10, 0xff, 0x02, 0x00, 0x10,
19     0xff, 0x02, 0x00, 0x10, 0xff, 0x02, 0x00, 0x10, 0xff, 0x02, 0x00,
20     0x10, 0xff, 0x03, 0x00, 0x10, 0xff, 0xb4, 0xc8, 0xba, 0x13};
21 
22 // A 1MB file of all zeros created using
23 // dd if=/dev/zero of=zeros-file bs=1024 count=1024
24 // zstd -c zeros-file | xxd -i
25 constexpr std::array<unsigned char, 54> zeros = {
26     0x28, 0xb5, 0x2f, 0xfd, 0xa4, 0x00, 0x00, 0x10, 0x00, 0x54, 0x00,
27     0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0xfb, 0xff, 0x39, 0xc0, 0x02,
28     0x02, 0x00, 0x10, 0x00, 0x02, 0x00, 0x10, 0x00, 0x02, 0x00, 0x10,
29     0x00, 0x02, 0x00, 0x10, 0x00, 0x02, 0x00, 0x10, 0x00, 0x02, 0x00,
30     0x10, 0x00, 0x03, 0x00, 0x10, 0x00, 0xf1, 0x3e, 0x16, 0xe1};
31 
32 // A 0 byte file created using
33 // touch empty-file
34 // zstd -c empty-file | xxd -i
35 constexpr std::array<unsigned char, 13> empty{
36     0x28, 0xb5, 0x2f, 0xfd, 0x24, 0x00, 0x01,
37     0x00, 0x00, 0x99, 0xe9, 0xd8, 0x51};
38 
39 } // namespace zstd
40 } // namespace bmcweb
41