fluidsynth/test/test_snprintf.c
derselbst 9382edabd5 enforce coding style guide
using astyle
2018-06-24 13:13:18 +02:00

23 lines
490 B
C

#include "test.h"
#include "utils/fluidsynth_priv.h"
// this test makes sure FLUID_SNPRINTF uses a proper C99 compliant implementation
int main(void)
{
char buf[2 + 1];
int ret = FLUID_SNPRINTF(buf, sizeof(buf), "99");
TEST_ASSERT(ret == 2);
TEST_ASSERT(buf[2] == '\0');
ret = FLUID_SNPRINTF(buf, sizeof(buf), "999");
TEST_ASSERT(ret == 3);
// output truncated, buffer must be NULL terminated!
TEST_ASSERT(buf[2] == '\0');
return EXIT_SUCCESS;
}