From 24c460b977c014076821a36b2dae574893cebb85 Mon Sep 17 00:00:00 2001 From: Marco Paland Date: Tue, 15 May 2018 12:14:51 +0200 Subject: feat(printf): added new oprintf() function Write formatted output directly to given output function --- test/test_suite.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/test_suite.cpp') diff --git a/test/test_suite.cpp b/test/test_suite.cpp index 9a02b1e..c5614b0 100644 --- a/test/test_suite.cpp +++ b/test/test_suite.cpp @@ -50,8 +50,6 @@ void test::_putchar(char character) TEST_CASE("printf", "[]" ) { - char buffer[100]; - printf_idx = 0U; memset(printf_buffer, 0xCC, 100U); REQUIRE(test::printf("% d", 4232) == 5); @@ -59,6 +57,14 @@ TEST_CASE("printf", "[]" ) { } +TEST_CASE("oprintf", "[]" ) { + printf_idx = 0U; + memset(printf_buffer, 0xCC, 100U); + test::oprintf(&test::_putchar, "This is a test of %X", 0x12EFU); + REQUIRE(!strcmp(printf_buffer, "This is a test of 12EF")); +} + + TEST_CASE("snprintf", "[]" ) { char buffer[100]; -- cgit v1.2.3