fluidsynth/test/test_snprintf.c
derselbst 9ef169cb00 fix building CoreAudio on OSX 10.4
by cleaning up fluidsynth's private includes
2019-02-15 17:55:02 +01:00

23 lines
484 B
C

#include "test.h"
#include "utils/fluid_sys.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;
}