|
6 | 6 |
|
7 | 7 | #include <clientversion.h>
|
8 | 8 | #include <sync.h>
|
| 9 | +#include <test/setup_common.h> |
9 | 10 | #include <test/util.h>
|
10 |
| -#include <util/strencodings.h> |
11 | 11 | #include <util/moneystr.h>
|
| 12 | +#include <util/strencodings.h> |
| 13 | +#include <util/string.h> |
12 | 14 | #include <util/time.h>
|
13 |
| -#include <test/setup_common.h> |
14 | 15 |
|
15 | 16 | #include <stdint.h>
|
16 | 17 | #include <thread>
|
@@ -123,6 +124,19 @@ BOOST_AUTO_TEST_CASE(util_HexStr)
|
123 | 124 | );
|
124 | 125 | }
|
125 | 126 |
|
| 127 | +BOOST_AUTO_TEST_CASE(util_Join) |
| 128 | +{ |
| 129 | + // Normal version |
| 130 | + BOOST_CHECK_EQUAL(Join({}, ", "), ""); |
| 131 | + BOOST_CHECK_EQUAL(Join({"foo"}, ", "), "foo"); |
| 132 | + BOOST_CHECK_EQUAL(Join({"foo", "bar"}, ", "), "foo, bar"); |
| 133 | + |
| 134 | + // Version with unary operator |
| 135 | + const auto op_upper = [](const std::string& s) { return ToUpper(s); }; |
| 136 | + BOOST_CHECK_EQUAL(Join<std::string>({}, ", ", op_upper), ""); |
| 137 | + BOOST_CHECK_EQUAL(Join<std::string>({"foo"}, ", ", op_upper), "FOO"); |
| 138 | + BOOST_CHECK_EQUAL(Join<std::string>({"foo", "bar"}, ", ", op_upper), "FOO, BAR"); |
| 139 | +} |
126 | 140 |
|
127 | 141 | BOOST_AUTO_TEST_CASE(util_FormatISO8601DateTime)
|
128 | 142 | {
|
|
0 commit comments