test-compress.c revision 843fecc076c8a58cda13e51362d145f7452db0e9
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering This file is part of systemd
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering Copyright 2014 Ronny Chevalier
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering systemd is free software; you can redistribute it and/or modify it
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering under the terms of the GNU Lesser General Public License as published by
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering (at your option) any later version.
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering systemd is distributed in the hope that it will be useful, but
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering Lesser General Public License for more details.
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering You should have received a copy of the GNU Lesser General Public License
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poetteringstatic void test_compress_uncompress(void) {
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering char text[] = "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering _cleanup_free_ char *uncompressed = NULL;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering assert_se(compress_blob(text, sizeof(text), compressed, &csize));
d4205751d4643c272059a3728045929dd0e5e800Lennart Poetteringstatic void test_uncompress_startswith(void) {
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering char text[] = "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering _cleanup_free_ char *uncompressed = NULL;
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering assert_se(compress_blob(text, sizeof(text), compressed, &csize));
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering assert_se(uncompress_startswith(compressed,
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering assert_se(!uncompress_startswith(compressed,