test-util.c revision 144e51eca20b72c8177314c225d8c15c1b0b9d6b
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
Copyright 2013 Thomas H.P. Andersen
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 <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "util.h"
static void test_streq_ptr(void) {
}
static void test_first_word(void) {
}
static void test_close_many(void) {
int fds[3];
char name0[] = "/tmp/test-close-many.XXXXXX";
char name1[] = "/tmp/test-close-many.XXXXXX";
char name2[] = "/tmp/test-close-many.XXXXXX";
}
static void test_parse_boolean(void) {
}
static void test_parse_pid(void) {
int r;
assert_se(r == 0);
assert_se(r == 0);
}
static void test_parse_uid(void) {
int r;
assert_se(r == 0);
}
static void test_safe_atolli(void) {
int r;
long long l;
r = safe_atolli("12345", &l);
assert_se(r == 0);
assert_se(l == 12345);
r = safe_atolli("junk", &l);
}
static void test_safe_atod(void) {
int r;
double d;
r = safe_atod("0.2244", &d);
assert_se(r == 0);
r = safe_atod("junk", &d);
}
static void test_strappend(void) {
}
static void test_strstrip(void) {
char *r;
char input[] = " hello, waldo. ";
}
static void test_delete_chars(void) {
char *r;
char input[] = " hello, waldo. abc";
}
static void test_in_charset(void) {
}
static void test_hexchar(void) {
}
static void test_unhexchar(void) {
}
static void test_octchar(void) {
}
static void test_unoctchar(void) {
}
static void test_decchar(void) {
}
static void test_undecchar(void) {
}
static void test_foreach_word(void) {
char *w, *state;
size_t l;
int i = 0;
const char test[] = "test abc d\te f ";
const char * const expected[] = {
"test",
"abc",
"d",
"e",
"f",
"",
};
}
}
static void test_foreach_word_quoted(void) {
char *w, *state;
size_t l;
int i = 0;
const char test[] = "test a b c 'd' e '' '' hhh '' '' \"a b c\"";
const char * const expected[] = {
"test",
"a",
"b",
"c",
"d",
"e",
"",
"",
"hhh",
"",
"",
"a b c",
};
_cleanup_free_ char *t = NULL;
printf("<%s>\n", t);
}
}
static void test_default_term_for_tty(void) {
}
static void test_memdup_multiply(void) {
int *dup;
}
static void test_bus_path_escape_one(const char *a, const char *b) {
assert_se(t = bus_path_escape(a));
assert_se(x = bus_path_unescape(t));
assert_se(y = bus_path_unescape(b));
}
static void test_bus_path_escape(void) {
}
static void test_hostname_is_valid(void) {
assert(!hostname_is_valid("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"));
}
static void test_u64log2(void) {
}
test_hexchar();
test_octchar();
test_decchar();
test_u64log2();
return 0;
}