From 9c053ec1b1c7cd91ca6c0cc6f65803cc3f114c7f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 27 Mar 2020 16:58:18 +0200 Subject: Add namespace to format rcc: - add -n/--namespace to command line - make default compression None - fix None compression not printing hexdumps libembed: - add a zstd decompression test --- test/main.cpp | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/main.cpp b/test/main.cpp index faf5a16..f17ef67 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,17 +1,32 @@ -#include #include "resources.h" +#include "zstd_resources.h" #include +#include -int main(int argc, char** argv) +embed::Resources zstd_ctx(zstd_data::dictionary); + +int main(int, char **) { -// testing::InitGoogleTest(&argc, argv); -// return RUN_ALL_TESTS(); - embed::Resources ctx(metadata); - constexpr auto raw = entries.at("/icons/chevron-up.svg"); - static_assert(!raw.empty()); - const auto x = ctx.decompress(raw); - for(const char c : x) - printf("%c", c); - delete[] x.data(); - return 0; + for(const auto &pair : zstd_data::entries) { + const auto s = staticdata::entries.at(pair.first); + const auto v = zstd_ctx.decompress(pair.second); + + if(s.size() != v.size()) { + printf("failed comparing sizes at path [%s]\n", pair.first.data()); + printf("s: %li != v: %li\n", s.size(), v.size()); + return EXIT_FAILURE; + } + + if(!std::equal(s.begin(), s.end(), v.begin(), v.end())) { + printf("failed comparing values at path [%s]\n", pair.first.data()); + for(const char &c : s) + printf("%c", c); + for(const char &c : v) + printf("%c", c); + return EXIT_FAILURE; + } + } + printf("Zstd compression test complete\n"); + + return EXIT_SUCCESS; } -- cgit v1.2.1