basedOpinionated utility library |
git clone git://git.dimitrijedobrota.com/based.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
format_test.cpp (700B)
0 #include "based/string/format.hpp"
2 #include <catch2/catch_test_macros.hpp>
4 TEST_CASE("format", "[string/format]")
5 {
6 const std::string format = "This is a {}! {}";
8 SECTION("none")
9 {
10 const auto res = based::string_format(format);
11 REQUIRE(res == "This is a {}! {}");
12 }
14 SECTION("one")
15 {
16 const auto res = based::string_format(format, "test");
17 REQUIRE(res == "This is a test! {}");
18 }
20 SECTION("two")
21 {
22 const auto res = based::string_format(format, "test", "hello");
23 REQUIRE(res == "This is a test! hello");
24 }
26 SECTION("three")
27 {
28 const auto res = based::string_format(format, "test", "hello", "yo");
29 REQUIRE(res == "This is a test! hello");
30 }
31 }