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:
parent
51d58ad366
commit
e7d355f950
4 changed files with 8 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -40,4 +40,5 @@
|
||||||
/tests/test_multiboot2_print
|
/tests/test_multiboot2_print
|
||||||
/tests/test_multiboot2_validation
|
/tests/test_multiboot2_validation
|
||||||
/tests/test_pfa
|
/tests/test_pfa
|
||||||
|
/tests/test_printf
|
||||||
/tests/test_stdlib
|
/tests/test_stdlib
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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);
|
void kernaux_printf_va(void (*putchar)(char), const char *format, va_list va);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Binary file not shown.
|
@ -33,6 +33,11 @@ static void test(const char *const expected, const char *const format, ...)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
memset(buffer, '\0', sizeof(buffer));
|
||||||
|
buffer_index = 0;
|
||||||
|
kernaux_printf(test_putchar, "Hello, World!");
|
||||||
|
assert(strcmp("Hello, World!", buffer) == 0);
|
||||||
|
|
||||||
test("", "");
|
test("", "");
|
||||||
test("Hello, World!", "Hello, World!");
|
test("Hello, World!", "Hello, World!");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue