Skip to content

Commit 3fd2594

Browse files
committed
[unit] {TensorFixture,TensorUMFixture}::r member initialization must occur in the ctor to ensure that GlobalFixture::world is already initialized
not sure why the initialization order has changed to reveal this issue
1 parent 5b4e68f commit 3fd2594

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

tests/tensor.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "tiledarray.h"
2828
#include "unit_test_config.h"
2929

30-
const TensorFixture::range_type TensorFixture::r = make_range(81);
31-
3230
BOOST_FIXTURE_TEST_SUITE(tensor_suite, TensorFixture, TA_UT_LABEL_SERIAL)
3331

3432
BOOST_AUTO_TEST_CASE(anatomy) {

tests/tensor_fixture.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ struct TensorFixture {
4141
typedef TensorN::range_type::index_view_type index_view_type;
4242
typedef TensorN::range_type range_type;
4343

44-
static const range_type r;
44+
const range_type r;
4545

46-
TensorFixture() : t(r) { rand_fill(18, t.size(), t.data()); }
46+
TensorFixture() : r(make_range(81)), t(r) {
47+
rand_fill(18, t.size(), t.data());
48+
}
4749

4850
~TensorFixture() {}
4951

tests/tensor_um.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ struct TensorUMFixture {
3232
typedef TensorN::range_type::index_view_type* index_view_type;
3333
typedef TensorN::range_type range_type;
3434

35-
static const range_type r;
35+
const range_type r;
3636

37-
TensorUMFixture() : t(r) { rand_fill(18, t.size(), t.data()); }
37+
TensorUMFixture() : r(make_range(81)), t(r) {
38+
rand_fill(18, t.size(), t.data());
39+
}
3840

3941
~TensorUMFixture() {}
4042

@@ -85,8 +87,6 @@ struct TensorUMFixture {
8587
TensorN t;
8688
};
8789

88-
const TensorUMFixture::range_type TensorUMFixture::r = make_range(81);
89-
9090
BOOST_FIXTURE_TEST_SUITE(tensor_um_suite, TensorUMFixture, TA_UT_LABEL_SERIAL)
9191

9292
BOOST_AUTO_TEST_CASE(default_constructor) {

0 commit comments

Comments
 (0)