Skip to content

Commit 51f1f2b

Browse files
committed
Move constify to own header
1 parent 7635e76 commit 51f1f2b

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

src/Beman/Optional26/tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ target_sources(
1919
optional_ref.t.cpp
2020
optional.t.cpp
2121
optional_constexpr.t.cpp
22-
test_types.cpp)
22+
test_types.cpp
23+
test_utilities.cpp)
2324

2425
target_link_libraries(
2526
beman_optional26_test

src/Beman/Optional26/tests/optional_constexpr.t.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <Beman/Optional26/optional.hpp>
55
#include <Beman/Optional26/tests/test_types.hpp>
6+
#include <Beman/Optional26/tests/test_utilities.hpp>
67

78
#include <functional>
89
#include <ranges>
@@ -220,7 +221,7 @@ consteval bool testConstexprInPlace() {
220221
return retval;
221222
}
222223

223-
auto consteval constify(auto expr) { return (expr); }
224+
using beman::optional26::tests::constify;
224225

225226
TEST(OptionalConstexprTest, InPlace) {
226227
EXPECT_TRUE(constify(testConstexprInPlace()));
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// src/Beman/Optional26/test/test_utilities.cpp -*-C++-*-
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
#include <Beman/Optional26/tests/test_utilities.hpp>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// src/Beman/Optional26/tests/test_utilities.hpp -*-C++-*-
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
#ifndef BEMAN_OPTIONAL26_TESTS_TEST_UTILITIES_HPP
5+
#define BEMAN_OPTIONAL26_TESTS_TEST_UTILITIES_HPP
6+
7+
namespace beman::optional26::tests {
8+
/***
9+
* Evaluate and return an expression in a consteval context for testing
10+
* constexpr correctness.
11+
*/
12+
auto consteval constify(auto expr) { return (expr); }
13+
} // namespace beman::optional26::tests
14+
15+
#endif

0 commit comments

Comments
 (0)