util-tests.c revision 7a4e3e29196e3abc1746714fcf93624edae89f93
45e9809aff7304721fddb95654901b32195c9c7avboxsync Stephen Gallagher <sgallagh@redhat.com>
45e9809aff7304721fddb95654901b32195c9c7avboxsync Copyright (C) 2010 Red Hat
45e9809aff7304721fddb95654901b32195c9c7avboxsync This program is free software; you can redistribute it and/or modify
45e9809aff7304721fddb95654901b32195c9c7avboxsync it under the terms of the GNU General Public License as published by
45e9809aff7304721fddb95654901b32195c9c7avboxsync the Free Software Foundation; either version 3 of the License, or
45e9809aff7304721fddb95654901b32195c9c7avboxsync (at your option) any later version.
45e9809aff7304721fddb95654901b32195c9c7avboxsync This program is distributed in the hope that it will be useful,
45e9809aff7304721fddb95654901b32195c9c7avboxsync but WITHOUT ANY WARRANTY; without even the implied warranty of
45e9809aff7304721fddb95654901b32195c9c7avboxsync MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45e9809aff7304721fddb95654901b32195c9c7avboxsync GNU General Public License for more details.
45e9809aff7304721fddb95654901b32195c9c7avboxsync You should have received a copy of the GNU General Public License
45e9809aff7304721fddb95654901b32195c9c7avboxsync along with this program. If not, see <http://www.gnu.org/licenses/>.
45e9809aff7304721fddb95654901b32195c9c7avboxsync ret = add_string_to_list(global_talloc_context, "ABC", &list);
45e9809aff7304721fddb95654901b32195c9c7avboxsync fail_unless(ret == EOK, "Adding string to non-existing list failed.");
45e9809aff7304721fddb95654901b32195c9c7avboxsync fail_unless(list[0] != NULL, "String not added to new list.");
bool is_in;
NULL};
struct pa_testcase {
const char *argstr;
const char **parsed;
int i, ii;
int ret;
char **parsed;
char **only_ret;
char **only_exp;
char **both;
if (parsed) {
int parsed_len;
int expected_len;
char **l1;
char **l2;
char **l3;
char **only_l1;
char **only_l2;
char **both;
int ret;
int fd;
int flags;
&nlen);
fail_if(strlen((const char *) munchen_utf8_upcase) != nlen); /* This is not true for utf8 strings in general */
&nsize);
char *lcase;
bool ret;
unsigned int init_seed;
unsigned int seed;
for (i = 0; i < len; i++) {
void setup_atomicio(void)
int ret;
void teardown_atomicio(void)
int ret;
int fd;
errno = 0;
errno = 0;
errno = 0;
errno = 0;
total = 0;
errno = 0;
} while (numread != 0);
errno = 0;
errno = 0;
errno = 0;
int fd;
errno = 0;
struct split_data {
const char *input;
const char **expected_list;
bool trim;
bool skip_empty;
int expected_size;
int expected_ret;
int size;
const char *str_ref;
const char *str_out;
int num_of_tests;
(const char*[]){NULL},
NULL,
NULL,
0, EINVAL
for (a = 0; a < num_of_tests; a++) {
if (ret) {
struct check_ip_test_data {
const char *str_ipaddr;
bool expected_ret;
int num_of_tests;
int ret;
bool bret;
for (a = 0; a < num_of_tests; a++) {
int num_of_tests;
int ret;
bool bret;
for (a = 0; a < num_of_tests; a++) {
const char *host;
const char *domain;
bool expected;
bool ret;
const char * const * svcs;
bool found_nss = false;
for (i = 0; svcs[i]; i++) {
found_nss = true;
if (tz) {
const char *error;
char last_character;
error);
int opt;
int failure_count;
switch(opt) {
if (failure_count == 0) {
return EXIT_SUCCESS;
return EXIT_FAILURE;