diff options
Diffstat (limited to 'asprintf.c')
-rw-r--r-- | asprintf.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -12,3 +12,23 @@ libsimple_asprintf(char **strp, const char *fmt, ...) va_end(ap); return r; } + + +#ifdef TEST +#include <assert.h> + +int +main(void) +{ + char *s = ""; + char *old = s; + + assert(libsimple_asprintf(&s, "%i %X", 99999, 255) == sizeof("99999 FF") - 1); + assert(s && s != old); + assert(!strcmp(s, "99999 FF")); + free(s); + + return 0; +} + +#endif |