Skip to content

Commit 42eb651

Browse files
committed
Update boost-ut
1 parent 1aa3088 commit 42eb651

File tree

2 files changed

+56
-147
lines changed

2 files changed

+56
-147
lines changed

tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ endfunction()
3131

3232
include(FetchContent)
3333

34+
set(BOOST_UT_DISABLE_MODULE ON)
3435
FetchContent_Declare(boost_ut
3536
GIT_REPOSITORY https://github.com/boost-ext/ut.git
36-
GIT_TAG v1.1.9
37+
GIT_TAG v2.3.1
3738
UPDATE_COMMAND git checkout .
3839
PATCH_COMMAND git apply ${PROJECT_SOURCE_DIR}/tests/boost_ut_fix.patch)
3940
FetchContent_MakeAvailable(boost_ut)

tests/boost_ut_fix.patch

Lines changed: 54 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,8 @@
1-
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index b9e94ab..bd6bb6a 100644
3-
--- a/CMakeLists.txt
4-
+++ b/CMakeLists.txt
5-
@@ -61,61 +61,61 @@ else()
6-
target_compile_features(ut INTERFACE cxx_std_17)
7-
endif()
8-
9-
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
10-
- if(WIN32) # clang-cl
11-
- # FIXME: we should not export this pedantic options! CK
12-
- target_compile_options(
13-
- ut
14-
- INTERFACE -Wall
15-
- -Wextra
16-
- # FIXME -Werror
17-
- -Wno-c++98-c++11-c++14-c++17-compat-pedantic
18-
- -Wno-c++98-c++11-compat
19-
- -Wno-c++98-compat
20-
- -Wno-c++98-compat-pedantic
21-
- -Wno-c99-extensions
22-
- -Wno-pedantic
23-
- )
24-
- else()
25-
- add_compile_options(-Wall -Wextra -Wpedantic -Werror)
26-
- endif()
27-
-elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
28-
- # FIXME: we should not export this pedantic options! CK
29-
- target_compile_options(
30-
- ut
31-
- INTERFACE -Wall
32-
- -Wextra
33-
- # TODO: why not simpply -Wpedantic
34-
- -Werror
35-
- -Wcast-align
36-
- #-Wcast-align=strict
37-
- -Wcast-qual
38-
- -Wdouble-promotion
39-
- -Wduplicated-branches
40-
- -Wduplicated-cond
41-
- -Wlogical-op
42-
- -Wmissing-declarations
43-
- -Wmissing-include-dirs
44-
- -Wnull-dereference
45-
- -Wold-style-cast
46-
- -Wpointer-arith
47-
- -Wredundant-decls
48-
- -Wsign-conversion
49-
- -Wswitch-enum
50-
- -Wtrampolines
51-
- -Wunused-but-set-variable
52-
- -Wunused-result
53-
- -Wuseless-cast
54-
- -Wzero-as-null-pointer-constant
55-
- # FIXME
56-
- -Wno-undef
57-
- -Wno-missing-declarations
58-
- -Wno-sign-conversion
59-
- -Wno-float-equal
60-
- )
61-
-elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
62-
- add_compile_options(/W4 /WX)
63-
-endif()
64-
+# if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
65-
+# if(WIN32) # clang-cl
66-
+# # FIXME: we should not export this pedantic options! CK
67-
+# target_compile_options(
68-
+# ut
69-
+# INTERFACE -Wall
70-
+# -Wextra
71-
+# # FIXME -Werror
72-
+# -Wno-c++98-c++11-c++14-c++17-compat-pedantic
73-
+# -Wno-c++98-c++11-compat
74-
+# -Wno-c++98-compat
75-
+# -Wno-c++98-compat-pedantic
76-
+# -Wno-c99-extensions
77-
+# -Wno-pedantic
78-
+# )
79-
+# else()
80-
+# add_compile_options(-Wall -Wextra -Wpedantic -Werror)
81-
+# endif()
82-
+# elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
83-
+# # FIXME: we should not export this pedantic options! CK
84-
+# target_compile_options(
85-
+# ut
86-
+# INTERFACE -Wall
87-
+# -Wextra
88-
+# # TODO: why not simpply -Wpedantic
89-
+# -Werror
90-
+# -Wcast-align
91-
+# #-Wcast-align=strict
92-
+# -Wcast-qual
93-
+# -Wdouble-promotion
94-
+# -Wduplicated-branches
95-
+# -Wduplicated-cond
96-
+# -Wlogical-op
97-
+# -Wmissing-declarations
98-
+# -Wmissing-include-dirs
99-
+# -Wnull-dereference
100-
+# -Wold-style-cast
101-
+# -Wpointer-arith
102-
+# -Wredundant-decls
103-
+# -Wsign-conversion
104-
+# -Wswitch-enum
105-
+# -Wtrampolines
106-
+# -Wunused-but-set-variable
107-
+# -Wunused-result
108-
+# -Wuseless-cast
109-
+# -Wzero-as-null-pointer-constant
110-
+# # FIXME
111-
+# -Wno-undef
112-
+# -Wno-missing-declarations
113-
+# -Wno-sign-conversion
114-
+# -Wno-float-equal
115-
+# )
116-
+# elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
117-
+# add_compile_options(/W4 /WX)
118-
+# endif()
119-
120-
add_custom_target(style)
121-
add_custom_command(
1221
diff --git a/include/boost/ut.hpp b/include/boost/ut.hpp
123-
index 47faa56..5abb44c 100644
2+
index b39e964..828cfbf 100644
1243
--- a/include/boost/ut.hpp
1254
+++ b/include/boost/ut.hpp
126-
@@ -671,8 +671,8 @@ struct eq_ : op {
5+
@@ -1020,8 +1020,8 @@ struct eq_ : op {
1276
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
1287
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
1298

@@ -134,7 +13,18 @@ index 47faa56..5abb44c 100644
13413
const bool value_{};
13514
};
13615

137-
@@ -704,8 +704,8 @@ struct neq_ : op {
16+
@@ -1047,8 +1047,8 @@ struct approx_ : op {
17+
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
18+
[[nodiscard]] constexpr auto epsilon() const { return get(epsilon_); }
19+
20+
- const TLhs lhs_{};
21+
- const TRhs rhs_{};
22+
+ const TLhs& lhs_{};
23+
+ const TRhs& rhs_{};
24+
const TEpsilon epsilon_{};
25+
const bool value_{};
26+
};
27+
@@ -1085,8 +1085,8 @@ struct neq_ : op {
13828
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
13929
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
14030

@@ -145,7 +35,7 @@ index 47faa56..5abb44c 100644
14535
const bool value_{};
14636
};
14737

148-
@@ -727,8 +727,8 @@ struct gt_ : op {
38+
@@ -1108,8 +1108,8 @@ struct gt_ : op {
14939
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
15040
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
15141

@@ -156,7 +46,7 @@ index 47faa56..5abb44c 100644
15646
const bool value_{};
15747
};
15848

159-
@@ -750,8 +750,8 @@ struct ge_ : op {
49+
@@ -1131,8 +1131,8 @@ struct ge_ : op {
16050
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
16151
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
16252

@@ -167,7 +57,7 @@ index 47faa56..5abb44c 100644
16757
const bool value_{};
16858
};
16959

170-
@@ -774,8 +774,8 @@ struct lt_ : op {
60+
@@ -1162,8 +1162,8 @@ struct lt_ : op {
17161
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
17262

17363
private:
@@ -178,7 +68,7 @@ index 47faa56..5abb44c 100644
17868
const bool value_{};
17969
};
18070

181-
@@ -797,8 +797,8 @@ struct le_ : op {
71+
@@ -1185,8 +1185,8 @@ struct le_ : op {
18272
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
18373
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
18474

@@ -189,7 +79,7 @@ index 47faa56..5abb44c 100644
18979
const bool value_{};
19080
};
19181

192-
@@ -813,8 +813,8 @@ struct and_ : op {
82+
@@ -1201,8 +1201,8 @@ struct and_ : op {
19383
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
19484
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
19585

@@ -200,7 +90,7 @@ index 47faa56..5abb44c 100644
20090
const bool value_{};
20191
};
20292

203-
@@ -829,8 +829,8 @@ struct or_ : op {
93+
@@ -1217,8 +1217,8 @@ struct or_ : op {
20494
[[nodiscard]] constexpr auto lhs() const { return get(lhs_); }
20595
[[nodiscard]] constexpr auto rhs() const { return get(rhs_); }
20696

@@ -211,7 +101,16 @@ index 47faa56..5abb44c 100644
211101
const bool value_{};
212102
};
213103

214-
@@ -1532,7 +1532,7 @@ struct that_ {
104+
@@ -1230,7 +1230,7 @@ struct not_ : op {
105+
[[nodiscard]] constexpr operator bool() const { return value_; }
106+
[[nodiscard]] constexpr auto value() const { return get(t_); }
107+
108+
- const T t_{};
109+
+ const T& t_{};
110+
const bool value_{};
111+
};
112+
113+
@@ -2410,7 +2410,7 @@ struct that_ {
215114
return static_cast<bool>(t_);
216115
}
217116

@@ -220,24 +119,33 @@ index 47faa56..5abb44c 100644
220119
};
221120

222121
template <class T>
223-
@@ -1846,19 +1846,19 @@ template <class F, class T,
224-
template <
225-
class F, template <class...> class T, class... Ts,
226-
type_traits::requires_t<not type_traits::is_container_v<T<Ts...>>> = 0>
122+
@@ -2771,7 +2771,7 @@ template <class F, class T>
123+
124+
template <class F, template <class...> class T, class... Ts>
125+
requires(!std::ranges::range<T<Ts...>>)
227126
-[[nodiscard]] constexpr auto operator|(const F& f, const T<Ts...>& t) {
228-
- return [f, t](const auto name) {
229127
+[[nodiscard]] constexpr auto operator|(const F& f, T<Ts...>&& t) {
230-
+ return [f, &t](const auto name) {
128+
constexpr auto unique_name = []<class TArg>(std::string_view name,
129+
const TArg& arg, int& counter) {
130+
auto ret = std::string{name} + " (";
131+
@@ -2783,20 +2783,20 @@ template <class F, template <class...> class T, class... Ts>
132+
return ret;
133+
};
134+
135+
- return [f, t, unique_name](std::string_view type, std::string_view name) {
136+
+ return [f, &t, unique_name](std::string_view type, std::string_view name) {
137+
int counter = 1;
231138
apply(
232-
- [f, name](const auto&... args) {
233-
+ [f, name](auto&&... args) {
234-
(detail::on<F>(events::test<F, Ts>{.type = "test",
235-
.name = name,
236-
.tag = {},
237-
.location = {},
238-
- .arg = args,
239-
+ .arg = std::move(args),
240-
.run = f}),
139+
- [=, &counter](const auto&... args) {
140+
+ [=, &counter](auto&&... args) {
141+
(detail::on<F>(events::test<F, Ts>{
142+
.type = type,
143+
.name = unique_name.template operator()<Ts>(name, args, counter),
144+
.tag = {},
145+
.location = {},
146+
- .arg = args,
147+
+ .arg = std::move(args),
148+
.run = f}),
241149
...);
242150
},
243151
- t);

0 commit comments

Comments
 (0)