Skip to content
Snippets Groups Projects
Commit 5cb512cb authored by Timo Koch's avatar Timo Koch
Browse files

[test][fmt] Add vformat to fmt unit test

parent c078f5b2
No related branches found
No related tags found
1 merge request!3362[fmt] Update shipped version to 9.1.0
Pipeline #25922 passed
+2
...@@ -15,6 +15,12 @@ void testString(const std::string_view result, const std::string_view expected) ...@@ -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); 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[]) int main(int argc, char* argv[])
{ {
using namespace Dumux; using namespace Dumux;
...@@ -58,6 +64,9 @@ int main(int argc, char* argv[]) ...@@ -58,6 +64,9 @@ int main(int argc, char* argv[])
DUNE_THROW(Dune::Exception, "Unexpected computed buffer size: " << bufferSize << ", expected 2 for storing '42'"); 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; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment