test: cover the C API sixteen-argument limit

This commit is contained in:
Renan Pimentel 2026-10-22 16:43:15 -03:00
parent 0fc31633e7
commit 90aba93484

View File

@ -83,6 +83,15 @@ void test_buffer_size_query(void) {
ASSERT_INT_EQ(size, 15);
}
void test_max_supported_arguments(void) {
char buf[100];
int size =
fmt_format_cstr(buf, sizeof(buf), "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5);
ASSERT_INT_EQ(size, 16);
ASSERT_STR_EQ(buf, "0123456789012345");
}
void test_print(void) {
FILE* file = tmpfile();
if (!file) {
@ -107,6 +116,7 @@ int main(void) {
test_types();
test_zero_arguments();
test_buffer_size_query();
test_max_supported_arguments();
test_print();
printf("C API tests passed\n");
}