blob: f17ef67a21a7bdd880001ef956e5b5950b9637c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "resources.h"
#include "zstd_resources.h"
#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);
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;
}
|