Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Sep 30, 2024
1 parent 478d028 commit 0d6c148
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions native/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using namespace std;

bool run(int method, char* buffer, size_t buffer_length) {
bool run(compression_codec method, char* buffer, size_t buffer_length) {
int32_t len{0};
bool ok = iron_compress(true, method, buffer, buffer_length, nullptr, &len, compression_level::best);

Expand All @@ -27,31 +27,36 @@ bool run(int method, char* buffer, size_t buffer_length) {

TEST(Roundtrip, Snappy_1) {
char bytes[] = {'a', 'b', 'c'};
EXPECT_TRUE(run(1, bytes, 3));
EXPECT_TRUE(run(compression_codec::snappy, bytes, 3));
}

TEST(Roundtrip, Zstd_2) {
char bytes[] = {'a', 'b', 'c'};
EXPECT_TRUE(run(2, bytes, 3));
EXPECT_TRUE(run(compression_codec::zstd, bytes, 3));
}

TEST(Roundtrip, Gzip_3) {
EXPECT_FALSE(iron_is_supported(compression_codec::gzip));
EXPECT_FALSE(iron_compress(true, compression_codec::gzip,
nullptr, 0,
nullptr, nullptr,
compression_level::best));

//char bytes[] = {'a', 'b', 'c'};
//EXPECT_TRUE(run(3, bytes, 3));
}

TEST(Roundtrip, Brotli_4) {
char bytes[] = {'a', 'b', 'c'};
EXPECT_TRUE(run(4, bytes, 3));
EXPECT_TRUE(run(compression_codec::brotli, bytes, 3));
}

TEST(Roundtrip, Lzo_5) {
char bytes[] = {'a', 'b', 'c'};
EXPECT_TRUE(run(5, bytes, 3));
EXPECT_TRUE(run(compression_codec::lzo, bytes, 3));
}

TEST(Roundtrip, LZ4_6) {
char bytes[] = {'a', 'b', 'c'};
EXPECT_TRUE(run(6, bytes, 3));
EXPECT_TRUE(run(compression_codec::lz4, bytes, 3));
}

0 comments on commit 0d6c148

Please # to comment.