Skip to content

Commit e739f66

Browse files
committed
Move tests for back into their own file
1 parent a7b79ad commit e739f66

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
@@ -241,6 +241,7 @@ target_sources(containers_test PRIVATE
241241
test/array.cpp
242242
test/assign.cpp
243243
test/assign_to_empty.cpp
244+
test/back.cpp
244245
test/bidirectional_linked_list.cpp
245246
test/clear.cpp
246247
test/concatenate.cpp

source/containers/back.cpp

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

1313
import containers.algorithms.advance;
1414
import containers.begin_end;
15-
import containers.c_array;
1615
import containers.is_empty;
1716
import containers.range;
1817

@@ -23,10 +22,4 @@ export constexpr auto back(range auto && r) -> decltype(auto) {
2322
return *containers::prev(containers::end(OPERATORS_FORWARD(r)));
2423
}
2524

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

source/containers/test/back.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.back;
7+
8+
import containers.array;
9+
import containers.back;
10+
11+
static_assert(containers::back(containers::array({5})) == 5);
12+
static_assert(containers::back(containers::array({2, 3, 4})) == 4);

0 commit comments

Comments
 (0)