Skip to content

Commit 9f5eb84

Browse files
committed
Minor fixes
1 parent 3569423 commit 9f5eb84

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/ystdlib/containers/test/test_Array.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,7 @@ TEST_CASE("test_array_reference", "[containers][Array]") {
8888
arr.at(idx) = idx;
8989
}
9090
auto const& arr_const_ref = arr;
91-
for (int idx{0}; idx < cBufferSize; ++idx) {
92-
REQUIRE(arr_const_ref.at(idx) == idx);
93-
}
94-
}
95-
96-
TEST_CASE("test_array_illegal_access", "[containers][Array]") {
97-
Array<int> arr(cBufferSize);
98-
REQUIRE_THROWS_AS(arr.at(-1), std::out_of_range);
99-
REQUIRE_THROWS_AS(arr.at(cBufferSize), std::out_of_range);
91+
REQUIRE(std::ranges::equal(arr, arr_const_ref));
10092
}
10193

10294
TEST_CASE("test_array_ranged_copy", "[containers][Array]") {
@@ -120,6 +112,12 @@ TEST_CASE("test_array_movable", "[containers][Array]") {
120112
REQUIRE(std::ranges::equal(reference_array, arr_moved));
121113
}
122114

115+
TEST_CASE("test_array_illegal_access", "[containers][Array]") {
116+
Array<int> arr(cBufferSize);
117+
REQUIRE_THROWS_AS(arr.at(-1), std::out_of_range);
118+
REQUIRE_THROWS_AS(arr.at(cBufferSize), std::out_of_range);
119+
}
120+
123121
TEMPLATE_TEST_CASE(
124122
"test_array_fundamental_type_value_initialization",
125123
"[containers][Array]",
@@ -143,16 +141,11 @@ TEMPLATE_TEST_CASE(
143141
long double,
144142
std::nullptr_t
145143
) {
146-
Array<TestType> arr(cBufferSize);
147-
auto const& arr_const_ref = arr;
148-
149144
REQUIRE(std::is_fundamental_v<TestType>);
145+
Array<TestType> arr(cBufferSize);
150146
std::ranges::for_each(arr, [](auto const& p) -> void {
151147
REQUIRE((static_cast<TestType>(0) == p));
152148
});
153-
std::ranges::for_each(arr_const_ref, [](auto const& p) -> void {
154-
REQUIRE((static_cast<TestType>(0) == p));
155-
});
156149
}
157150

158151
TEST_CASE("test_array_list_initialization", "[containers][Array]") {
@@ -168,6 +161,7 @@ TEST_CASE("test_array_list_initialization", "[containers][Array]") {
168161
REQUIRE(std::ranges::equal(vec, arr));
169162

170163
// Test polymorphic list initialization
164+
REQUIRE(std::is_copy_constructible_v<PolymorphicConstructors>);
171165

172166
// Expected values to verify correct initialization of `PolymorphicConstructors`.
173167
// See the `PolymorphicConstructors` class for details on how constructor arguments are handled.

0 commit comments

Comments
 (0)