aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarco Paland <marco@paland.com>2018-05-15 12:14:51 +0200
committerMarco Paland <marco@paland.com>2018-05-15 12:14:51 +0200
commit24c460b977c014076821a36b2dae574893cebb85 (patch)
tree9308d0871a9dbf727392ac1bf2390c1e1906c3ac /test
parentd12e52be4c207bb3b8a35f512b2cddf8deb3ceaf (diff)
downloadprintf-24c460b977c014076821a36b2dae574893cebb85.tar.gz
printf-24c460b977c014076821a36b2dae574893cebb85.tar.bz2
printf-24c460b977c014076821a36b2dae574893cebb85.zip
feat(printf): added new oprintf() function
Write formatted output directly to given output function
Diffstat (limited to 'test')
-rw-r--r--test/test_suite.cpp10
1 files changed, 8 insertions, 2 deletions
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];