aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/main.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/main.cpp b/test/main.cpp
index f17ef67..f18332c 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -3,22 +3,23 @@
#include <cstdio>
#include <cstdlib>
-embed::Resources<zstd_data::compression> zstd_ctx(zstd_data::dictionary);
-
int main(int, char **)
{
- for(const auto &pair : zstd_data::entries) {
- const auto s = staticdata::entries.at(pair.first);
- const auto v = zstd_ctx.decompress(pair.second);
+ constexpr auto size = staticdata::entries.size();
+ constexpr embed::Resources static_ctx(staticdata::entries, staticdata::values);
+ const embed::CompressedResources zstd_ctx(zstd_data::entries, zstd_data::values, zstd_data::compression, zstd_data::dictionary);
+ for(std::size_t i = 0; i < size; ++i) {
+ const auto s = static_ctx.value(i);
+ const auto v = zstd_ctx.decompress(i);
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());
+ printf(" raw data at path [%s] size=%li\n", staticdata::entries.at(i), s.size());
+ printf(" zstd data at path [%s] size=%li\n", zstd_data::entries.at(i), 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());
+ printf("failed comparing values at path [%s]\n", staticdata::entries.at(i));
for(const char &c : s)
printf("%c", c);
for(const char &c : v)