Skip to content

Commit ffd48f4

Browse files
test
1 parent 96a98f8 commit ffd48f4

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

test/test_api.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,29 +138,29 @@ struct xsimd_api_test
138138
batch_type b = batch_type::load(v.data(), xsimd::aligned_mode());
139139
V res(size);
140140

141-
bool* b_data = new bool[size];
141+
std::array<bool, size> b_data;
142142

143143
xsimd::store_as(res.data(), b, xsimd::unaligned_mode());
144144
INFO(name, " unaligned");
145145
CHECK_VECTOR_EQ(res, v);
146146

147-
std::fill(b_data, b_data + size, false);
147+
std::fill(b_data.begin(), b_data.end(), false);
148148
batch_bool_type bb = (b == b);
149-
xsimd::store_as(b_data, bb, xsimd::unaligned_mode());
149+
xsimd::store_as(&b_data[0], bb, xsimd::unaligned_mode());
150150
INFO(name, " batch_bool unaligned");
151-
CHECK_UNARY(std::accumulate(b_data, b_data + size, true, std::logical_and<bool>()));
151+
CHECK_UNARY(std::accumulate(b_data.begin(), b_data.end(), true, std::logical_and<bool>()));
152152

153153
xsimd::store_as(res.data(), b, xsimd::aligned_mode());
154154
INFO(name, " aligned");
155155
CHECK_VECTOR_EQ(res, v);
156156

157-
std::fill(b_data, b_data + size, false);
157+
std::fill(b_data.begin(), b_data.end(), false);
158158
bb = (b == b);
159-
xsimd::store_as(b_data, bb, xsimd::aligned_mode());
159+
xsimd::store_as(&b_data[0], bb, xsimd::aligned_mode());
160160
INFO(name, " batch_bool aligned");
161-
CHECK_UNARY(std::accumulate(b_data, b_data + size, true, std::logical_and<bool>()));
162-
163-
delete[] b_data;
161+
std::array<bool, size> b_res;
162+
std::fill(b_res.begin(), b_res.end(), true);
163+
CHECK_ARRAY_EQ(b_res, b_data);
164164
}
165165

166166
template <class T>

test/test_utils.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,13 @@ namespace detail
538538
INFO(#v2 ":", v2); \
539539
CHECK_UNARY(::detail::expect_vector_near(v1, v2)); \
540540
} while (0)
541+
#define CHECK_ARRAY_EQ(v1, v2) \
542+
do \
543+
{ \
544+
INFO(#v1 ":", v1); \
545+
INFO(#v2 ":", v2); \
546+
CHECK_UNARY(::detail::expect_array_near(v1, v2)); \
547+
} while (0)
541548

542549
namespace xsimd
543550
{

0 commit comments

Comments
 (0)