~ashn/autil

e268e53d9b20ebd7796cc3ed65c2b5036dd8d83d — ashn a month ago b5b7dda
Add test for AUTIL_FMT_COUNT
4 files changed, 26 insertions(+), 1 deletions(-)

M Makefile
M autil.h
A test/autil_fmt_count.c
A test/autil_fmt_count.expected
M Makefile => Makefile +1 -0
@@ 39,6 39,7 @@ TESTS = \
	test/custom-allocator.test \
	test/autil_array_count.test \
	test/autil_cstr_count.test \
	test/autil_fmt_count.test \
	test/autil_isalnum.test \
	test/autil_isalpha.test \
	test/autil_isblank.test \

M autil.h => autil.h +1 -1
@@ 37,7 37,7 @@ USAGE
CHANGELOG
    Unreleased
    -------------------
    + Namespace library with AUTIL_ and autil_
    + Namespace library with AUTIL_ and autil_.
    + Added macro AUTIL_FMT_COUNT.
    + Added safe ctype functions: autil_isalnum, autil_isalpha, autil_isblank,
      autil_iscntrl, autil_isdigit, autil_isgraph, autil_islower, autil_isprint,

A test/autil_fmt_count.c => test/autil_fmt_count.c +18 -0
@@ 0,0 1,18 @@
#define AUTIL_IMPLEMENTATION
#include "../autil.h"

int
main(void)
{
    printf("%zu\n", AUTIL_FMT_COUNT("%d", 1));
    printf("%zu\n", AUTIL_FMT_COUNT("%d", 11));
    printf("%zu\n", AUTIL_FMT_COUNT("%d", 111));

    fputc('\n', stdout);

    printf("%zu\n", AUTIL_FMT_COUNT("%s", "foo"));
    printf("%zu\n", AUTIL_FMT_COUNT("%.*s", 2, "foo"));

    return EXIT_SUCCESS;
}


A test/autil_fmt_count.expected => test/autil_fmt_count.expected +6 -0
@@ 0,0 1,6 @@
1
2
3

3
2