2022-05-26 22:03:05 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <kernaux/printf_fmt.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
2022-11-29 12:06:01 -05:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2022-05-26 22:03:05 -04:00
|
|
|
|
2022-06-20 14:01:56 -04:00
|
|
|
void test_main()
|
2022-05-26 22:03:05 -04:00
|
|
|
{
|
|
|
|
{% for case in cases %}
|
|
|
|
{
|
2022-05-28 05:16:38 -04:00
|
|
|
const char *const format = {{ escape_str(case.in.format) }};
|
2022-05-26 22:03:05 -04:00
|
|
|
|
2022-11-29 12:06:01 -05:00
|
|
|
struct KernAux_PrintfFmt_Spec spec = KernAux_PrintfFmt_Spec_create(format);
|
2022-05-28 05:08:48 -04:00
|
|
|
|
|
|
|
if (spec.set_width) {
|
2022-05-28 04:56:48 -04:00
|
|
|
KernAux_PrintfFmt_Spec_set_width(&spec, {{ none_to_zero(case.in.width) }});
|
2022-05-26 22:03:05 -04:00
|
|
|
}
|
2022-05-28 05:08:48 -04:00
|
|
|
if (spec.set_precision) {
|
2022-05-28 04:56:48 -04:00
|
|
|
KernAux_PrintfFmt_Spec_set_precision(&spec, {{ none_to_zero(case.in.precision) }});
|
2022-05-26 22:03:05 -04:00
|
|
|
}
|
|
|
|
|
2022-11-29 12:06:01 -05:00
|
|
|
assert(spec.format_start == format);
|
|
|
|
|
2022-05-26 22:03:05 -04:00
|
|
|
assert(spec.flags == {{ escape_flags(case.out.flags) }});
|
|
|
|
assert(spec.width == {{ case.out.width }});
|
|
|
|
assert(spec.precision == {{ case.out.precision }});
|
|
|
|
assert(spec.type == {{ escape_type(case.out.type) }});
|
|
|
|
assert(spec.base == {{ case.out.base }});
|
|
|
|
}
|
|
|
|
{% endfor %}
|
|
|
|
}
|