1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-27 11:14:42 -05:00

Add tests to "kernaux_printf"

This commit is contained in:
Alex Kotov 2020-12-07 03:07:12 +05:00
parent 51d58ad366
commit e7d355f950
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View file

@ -40,4 +40,5 @@
/tests/test_multiboot2_print
/tests/test_multiboot2_validation
/tests/test_pfa
/tests/test_printf
/tests/test_stdlib

View file

@ -7,7 +7,8 @@
extern "C" {
#endif
void kernaux_printf(void (*putchar)(char), const char *format, ...);
void kernaux_printf(void (*putchar)(char), const char *format, ...)
__attribute__((format(printf, 2, 3)));
void kernaux_printf_va(void (*putchar)(char), const char *format, va_list va);
#ifdef __cplusplus

Binary file not shown.

View file

@ -33,6 +33,11 @@ static void test(const char *const expected, const char *const format, ...)
int main()
{
memset(buffer, '\0', sizeof(buffer));
buffer_index = 0;
kernaux_printf(test_putchar, "Hello, World!");
assert(strcmp("Hello, World!", buffer) == 0);
test("", "");
test("Hello, World!", "Hello, World!");