Skip to content

Commit c4a08e6

Browse files
committed
Test batch_constant from array
1 parent 98c4a59 commit c4a08e6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/test_batch_constant.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* The full license is in the file LICENSE, distributed with this software. *
1010
****************************************************************************/
1111

12+
#include <numeric>
13+
1214
#include "xsimd/xsimd.hpp"
1315
#ifndef XSIMD_NO_SUPPORTED_ARCHITECTURE
1416

@@ -43,6 +45,22 @@ struct constant_batch_test
4345
CHECK_BATCH_EQ((batch_type)b, expected);
4446
}
4547

48+
void test_init_from_array() const
49+
{
50+
#if __cplusplus >= 202002L
51+
constexpr array_type expected = []()
52+
{
53+
array_type out = {};
54+
std::iota(out.begin(), out.end(), 0);
55+
return out;
56+
}();
57+
58+
constexpr auto b = xsimd::make_batch_constant<expected, arch_type>();
59+
INFO("batch(value_type)");
60+
CHECK_BATCH_EQ((batch_type)b, expected);
61+
#endif
62+
}
63+
4664
void test_init_from_generator() const
4765
{
4866
array_type expected;
@@ -217,6 +235,8 @@ TEST_CASE_TEMPLATE("[constant batch]", B, BATCH_INT_TYPES)
217235
constant_batch_test<B> Test;
218236
SUBCASE("init_from_constant") { Test.test_init_from_constant(); }
219237

238+
SUBCASE("test_init_from_array") { Test.test_init_from_array(); }
239+
220240
SUBCASE("init_from_generator") { Test.test_init_from_generator(); }
221241

222242
SUBCASE("as_batch") { Test.test_cast(); }

0 commit comments

Comments
 (0)