@@ -33,6 +33,16 @@ struct constant_batch_test
3333 }
3434 };
3535
36+ void test_init_from_constant () const
37+ {
38+ array_type expected;
39+ std::generate (expected.begin (), expected.end (), []()
40+ { return 1 ; });
41+ constexpr auto b = xsimd::make_batch_constant<value_type, 1 , arch_type>();
42+ INFO (" batch(value_type)" );
43+ CHECK_BATCH_EQ ((batch_type)b, expected);
44+ }
45+
3646 void test_init_from_generator () const
3747 {
3848 array_type expected;
@@ -83,7 +93,7 @@ struct constant_batch_test
8393 }
8494 };
8595
86- void test_init_from_constant () const
96+ void test_init_from_constant_generator () const
8797 {
8898 array_type expected;
8999 std::fill (expected.begin (), expected.end (), constant<3 >::get (0 , 0 ));
@@ -142,6 +152,8 @@ struct constant_batch_test
142152TEST_CASE_TEMPLATE (" [constant batch]" , B, BATCH_INT_TYPES)
143153{
144154 constant_batch_test<B> Test;
155+ SUBCASE (" init_from_constant" ) { Test.test_init_from_constant (); }
156+
145157 SUBCASE (" init_from_generator" ) { Test.test_init_from_generator (); }
146158
147159 SUBCASE (" as_batch" ) { Test.test_cast (); }
@@ -151,7 +163,7 @@ TEST_CASE_TEMPLATE("[constant batch]", B, BATCH_INT_TYPES)
151163 Test.test_init_from_generator_arange ();
152164 }
153165
154- SUBCASE (" init_from_constant " ) { Test.test_init_from_constant (); }
166+ SUBCASE (" init_from_constant_generator " ) { Test.test_init_from_constant_generator (); }
155167
156168 SUBCASE (" operators" )
157169 {
@@ -178,6 +190,16 @@ struct constant_bool_batch_test
178190 }
179191 };
180192
193+ void test_init_from_constant () const
194+ {
195+ bool_array_type expected;
196+ std::generate (expected.begin (), expected.end (), []()
197+ { return false ; });
198+ constexpr auto b = xsimd::make_batch_bool_constant<value_type, false , arch_type>();
199+ INFO (" batch_bool_constant(value_type)" );
200+ CHECK_BATCH_EQ ((batch_bool_type)b, expected);
201+ }
202+
181203 void test_init_from_generator () const
182204 {
183205 bool_array_type expected;
@@ -270,6 +292,8 @@ struct constant_bool_batch_test
270292TEST_CASE_TEMPLATE (" [constant bool batch]" , B, BATCH_INT_TYPES)
271293{
272294 constant_bool_batch_test<B> Test;
295+ SUBCASE (" init_from_constant" ) { Test.test_init_from_constant (); }
296+
273297 SUBCASE (" init_from_generator" ) { Test.test_init_from_generator (); }
274298
275299 SUBCASE (" as_batch" ) { Test.test_cast (); }
0 commit comments