summaryrefslogtreecommitdiff
path: root/test/decompress.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-09-15 21:15:53 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-09-15 21:15:53 +0200
commitaa49abdf239bae6065fddd0839ec67a404c9748c (patch)
tree631fbb2df58aa35df3d60c65c037ef74b1807114 /test/decompress.cc
parentbf41a601fd0447bcf3a2937a595a1cd8ca5c1633 (diff)
Add .clang-format
Make it easier to keep a consistent style
Diffstat (limited to 'test/decompress.cc')
-rw-r--r--test/decompress.cc60
1 files changed, 26 insertions, 34 deletions
diff --git a/test/decompress.cc b/test/decompress.cc
index 35c4477..df1d08c 100644
--- a/test/decompress.cc
+++ b/test/decompress.cc
@@ -1,16 +1,14 @@
-#include <gtest/gtest.h>
-
#include "decompress.hh"
+#include <gtest/gtest.h>
+
TEST(z_decompress, empty) {
- static const unsigned char data[] = {
- 0x1f, 0x8b, 0x08, 0x08, 0x33, 0xd4, 0xbd, 0x68,
- 0x02, 0x03, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00
- };
- auto reader = decompress::gzip(io::memory(std::string(
- reinterpret_cast<const char*>(data), sizeof(data))));
+ static const unsigned char data[] = {0x1f, 0x8b, 0x08, 0x08, 0x33, 0xd4, 0xbd,
+ 0x68, 0x02, 0x03, 0x65, 0x6d, 0x70, 0x74,
+ 0x79, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00};
+ auto reader = decompress::gzip(io::memory(
+ std::string(reinterpret_cast<const char*>(data), sizeof(data))));
char buf[10];
auto got = reader->read(buf, sizeof(buf));
ASSERT_TRUE(got.has_value());
@@ -19,13 +17,12 @@ TEST(z_decompress, empty) {
TEST(z_decompress, hello) {
static const unsigned char data[] = {
- 0x1f, 0x8b, 0x08, 0x08, 0xf7, 0xd5, 0xbd, 0x68,
- 0x02, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00,
- 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0x07, 0x00, 0x82,
- 0x89, 0xd1, 0xf7, 0x05, 0x00, 0x00, 0x00,
+ 0x1f, 0x8b, 0x08, 0x08, 0xf7, 0xd5, 0xbd, 0x68, 0x02, 0x03, 0x68,
+ 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0x07,
+ 0x00, 0x82, 0x89, 0xd1, 0xf7, 0x05, 0x00, 0x00, 0x00,
};
- auto reader = decompress::gzip(io::memory(std::string(
- reinterpret_cast<const char*>(data), sizeof(data))));
+ auto reader = decompress::gzip(io::memory(
+ std::string(reinterpret_cast<const char*>(data), sizeof(data))));
char buf[10];
auto got = reader->read(buf, sizeof(buf));
ASSERT_TRUE(got.has_value());
@@ -36,13 +33,11 @@ TEST(z_decompress, hello) {
TEST(xz_decompress, empty) {
static const unsigned char data[] = {
- 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04,
- 0xe6, 0xd6, 0xb4, 0x46, 0x00, 0x00, 0x00, 0x00,
- 0x1c, 0xdf, 0x44, 0x21, 0x1f, 0xb6, 0xf3, 0x7d,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a
- };
- auto reader = decompress::xz(io::memory(std::string(
- reinterpret_cast<const char*>(data), sizeof(data))));
+ 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04, 0xe6, 0xd6, 0xb4,
+ 0x46, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xdf, 0x44, 0x21, 0x1f, 0xb6,
+ 0xf3, 0x7d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a};
+ auto reader = decompress::xz(io::memory(
+ std::string(reinterpret_cast<const char*>(data), sizeof(data))));
char buf[10];
auto got = reader->read(buf, sizeof(buf));
ASSERT_TRUE(got.has_value());
@@ -51,18 +46,15 @@ TEST(xz_decompress, empty) {
TEST(xz_decompress, hello) {
static const unsigned char data[] = {
- 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04,
- 0xe6, 0xd6, 0xb4, 0x46, 0x04, 0xc0, 0x09, 0x05,
- 0x21, 0x01, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x76, 0xe9, 0x07, 0x70,
- 0x01, 0x00, 0x04, 0x48, 0x65, 0x6c, 0x6c, 0x6f,
- 0x00, 0x00, 0x00, 0x00, 0xc8, 0xac, 0x7b, 0xc8,
- 0x3b, 0x5c, 0xcf, 0x51, 0x00, 0x01, 0x25, 0x05,
- 0x43, 0x91, 0x1f, 0xb8, 0x1f, 0xb6, 0xf3, 0x7d,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a,
+ 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04, 0xe6, 0xd6, 0xb4, 0x46,
+ 0x04, 0xc0, 0x09, 0x05, 0x21, 0x01, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x76, 0xe9, 0x07, 0x70, 0x01, 0x00, 0x04, 0x48,
+ 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xac, 0x7b, 0xc8,
+ 0x3b, 0x5c, 0xcf, 0x51, 0x00, 0x01, 0x25, 0x05, 0x43, 0x91, 0x1f, 0xb8,
+ 0x1f, 0xb6, 0xf3, 0x7d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a,
};
- auto reader = decompress::xz(io::memory(std::string(
- reinterpret_cast<const char*>(data), sizeof(data))));
+ auto reader = decompress::xz(io::memory(
+ std::string(reinterpret_cast<const char*>(data), sizeof(data))));
char buf[10];
auto got = reader->read(buf, sizeof(buf));
ASSERT_TRUE(got.has_value());