Skip to content

Commit 726e1f9

Browse files
committed
Move front tests to their own file.
1 parent 0109834 commit 726e1f9

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

source/containers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ target_sources(containers_test PRIVATE
247247
test/dynamic_array.cpp
248248
test/flat_map.cpp
249249
test/forward_linked_list.cpp
250+
test/front.cpp
250251
test/is_container.cpp
251252
test/insert.cpp
252253
test/lazy_push_back.cpp

source/containers/front.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module;
1111
export module containers.front;
1212

1313
import containers.begin_end;
14-
import containers.c_array;
1514
import containers.is_empty;
1615
import containers.range;
1716

@@ -22,10 +21,4 @@ export constexpr auto front(range auto && r) -> decltype(auto) {
2221
return *containers::begin(OPERATORS_FORWARD(r));
2322
}
2423

25-
} // namespace containers
26-
27-
constexpr containers::c_array<int, 1> one = {5};
28-
static_assert(containers::front(one) == 5);
29-
30-
constexpr containers::c_array<int, 3> three = {2, 3, 4};
31-
static_assert(containers::front(three) == 2);
24+
} // namespace containers

source/containers/test/front.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright David Stone 2024.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
export module containers.test.front;
7+
8+
import containers.array;
9+
import containers.front;
10+
11+
static_assert(containers::front(containers::array({5})) == 5);
12+
static_assert(containers::front(containers::array({2, 3, 4})) == 2);

0 commit comments

Comments
 (0)