/*
* This file originated in realmd
*
* Copyright 2012 Red Hat Inc
*
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the licence or (at
* your option) any later version.
*
* See the included COPYING file for more information.
*
* Author: Stef Walter <stefw@redhat.com>
*/
#include "config.h"
#include "src/util/safe-format-string.h"
#include <check.h>
#include <popt.h>
#include <string.h>
#include <talloc.h>
#ifndef ck_assert_int_ge
#endif
#ifndef ck_assert_int_lt
#endif
typedef struct {
const char *format;
const char *result;
} Fixture;
{
/* Just a bog standard string */
"blah"
},
{
/* Empty to print */
""
},
{
/* Nothing to print */
""
},
{
/* Width right aligned */
" blah"
},
{
/* Width left aligned */
"whoop dee doo"
},
{
/* Width space aligned (ignored) */
"whoop dee doo"
},
{
/* Width left space aligned (ignored) */
"whoop dee doo"
},
{
/* Precision 1 digit */
"whoop dee doo"
},
{
/* Precision, N digits */
"whoop deedle-dee doo"
},
{
/* Precision, zero digits */
"whoop doo"
},
{
/* Multiple simple arguments */
"space man dances"
},
{
/* Literal percent */
"100%% of space folk dance", { NULL, },
"100% of space folk dance"
},
{
/* Multiple simple arguments */
"space man dances"
},
{
/* Skipping an argument (not supported by standard printf) */
"space man dances"
},
/* Failures start here */
{
/* Unsupported conversion */
},
{
/* Bad positional argument */
},
{
/* Zero positional argument */
},
{
/* Too many args used */
},
{
/* Too many digits used */
},
};
static void
{
}
{
char *out;
int num_args;
int ret;
void *mem_ctx;
num_args++;
ck_assert_int_ge(ret, 0);
} else {
ck_assert_int_lt(ret, 0);
}
}
{
int ret;
ck_assert_int_eq(ret, 0);
ck_assert_int_lt(ret, 0);
}
static Suite *
create_safe_format_suite(void)
{
/* One for each fixture */
suite_add_tcase(s, tc_format);
return s;
}
int
{
int opt;
int failure_count;
};
switch(opt) {
default:
return 1;
}
}
/* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */
}