From 5cb512cba767f215f912509490a374b580180fc0 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Sun, 22 Jan 2023 14:14:36 +0100
Subject: [PATCH] [test][fmt] Add vformat to fmt unit test

---
 test/io/format/test_format.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/io/format/test_format.cc b/test/io/format/test_format.cc
index 290e519427..856f33037a 100644
--- a/test/io/format/test_format.cc
+++ b/test/io/format/test_format.cc
@@ -15,6 +15,12 @@ void testString(const std::string_view result, const std::string_view expected)
         DUNE_THROW(Dune::Exception, "Unexpected result: " << result << ", expected " << expected);
 }
 
+template <typename... Args>
+std::string dynamicFmtPrint(std::string_view fmt, Args&&... args)
+{
+    return Dumux::Fmt::vformat(fmt, Dumux::Fmt::make_format_args(args...));
+}
+
 int main(int argc, char* argv[])
 {
     using namespace Dumux;
@@ -58,6 +64,9 @@ int main(int argc, char* argv[])
             DUNE_THROW(Dune::Exception, "Unexpected computed buffer size: " << bufferSize << ", expected 2 for storing '42'");
     }
 
+    // dynamic format string
+    for (int i = 0; i < 10; ++i)
+        dynamicFmtPrint(std::to_string(i) + " = {} = {}\n", i, i);
 
     return 0;
 }
-- 
GitLab