test-compress.c revision 355b59e252c9910e44a1ad95c045ba8db58a4f6a
/***
This file is part of systemd
Copyright 2014 Ronny Chevalier
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "compress.h"
#include "util.h"
#include "macro.h"
static void test_compress_uncompress(void) {
char text[] = "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
"foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
char compressed[512];
(void **) &uncompressed,
7,
(void **) &uncompressed,
}
static void test_uncompress_startswith(void) {
char text[] = "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
"foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
char compressed[512];
(void **) &uncompressed,
&usize,
"foofoofoofoo", 12, ' '));
(void **) &uncompressed,
&usize,
"foofoofoofoo", 12, 'w'));
(void **) &uncompressed,
&usize,
"barbarbar", 9, ' '));
}
static void test_compress_stream(const char *srcfile) {
char pattern[] = "/tmp/systemd-test.xz.XXXXXX",
pattern2[] = "/tmp/systemd-test.xz.XXXXXX";
int r;
log_debug("/* test compression */");
assert(r == 0);
log_debug("/* test decompression */");
assert(r == 0);
log_debug("/* test faulty decompression */");
}
test_compress_stream(argv[0]);
return 0;
}