Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/bipartite_index_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ BOOST_AUTO_TEST_CASE(end_itr) {
BOOST_AUTO_TEST_CASE(at_member) {
for (auto&& [str, idx] : idxs) {
if (world.nproc() == 1) {
BOOST_CHECK_TA_ASSERT(idx.at(idx.size()),
BOOST_CHECK_THROW(idx.at(idx.size()),
#ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
std::out_of_range
std::out_of_range
#else
boost::container::out_of_range
boost::container::out_of_range
#endif
);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/block_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ BOOST_AUTO_TEST_CASE(block_zero_lower_bound) {
++count_invalid;

// Check for exception with invalid input
BOOST_CHECK_THROW(BlockRange(r0, lower, upper), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(BlockRange(r0, lower, upper),
TiledArray::Exception);
}
}
}
Expand Down Expand Up @@ -258,7 +259,8 @@ BOOST_AUTO_TEST_CASE(block) {
++count_invalid;

// Check for exception with invalid input
BOOST_CHECK_THROW(BlockRange(r, lower, upper), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(BlockRange(r, lower, upper),
TiledArray::Exception);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/dist_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ BOOST_AUTO_TEST_CASE(find_local) {
} else {
// Check that an exception is thrown when using a default constructed
// object
BOOST_CHECK_THROW(a.find_local(tile_idx), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(a.find_local(tile_idx), TiledArray::Exception);
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions tests/dist_op_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ BOOST_AUTO_TEST_CASE(constructor_empty) {

#if defined(MADNESS_ASSERTIONS_THROW)
// Check that accessing group data throws exceptions for an empty group.
BOOST_CHECK_TA_ASSERT(empty_group.id(), madness::MadnessException);
BOOST_CHECK_TA_ASSERT(empty_group.get_world(), madness::MadnessException);
BOOST_CHECK_TA_ASSERT(empty_group.rank(), madness::MadnessException);
BOOST_CHECK_TA_ASSERT(empty_group.rank(0), madness::MadnessException);
BOOST_CHECK_TA_ASSERT(empty_group.world_rank(0), madness::MadnessException);
BOOST_CHECK_THROW(empty_group.id(), madness::MadnessException);
BOOST_CHECK_THROW(empty_group.get_world(), madness::MadnessException);
BOOST_CHECK_THROW(empty_group.rank(), madness::MadnessException);
BOOST_CHECK_THROW(empty_group.rank(0), madness::MadnessException);
BOOST_CHECK_THROW(empty_group.world_rank(0), madness::MadnessException);
ProcessID parent, child1, child2;
BOOST_CHECK_TA_ASSERT(empty_group.make_tree(0, parent, child1, child2),
madness::MadnessException);
BOOST_CHECK_THROW(empty_group.make_tree(0, parent, child1, child2),
madness::MadnessException);
#endif // MADNESS_ASSERTIONS_THROW
}

Expand Down
2 changes: 1 addition & 1 deletion tests/distributed_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(array_operator) {

// Check throw for an out-of-range set.
BOOST_CHECK_TA_ASSERT(t.get(t.max_size()), TiledArray::Exception);
BOOST_CHECK_THROW(t.get(t.max_size() + 2), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.get(t.max_size() + 2), TiledArray::Exception);
}

BOOST_AUTO_TEST_SUITE_END()
8 changes: 4 additions & 4 deletions tests/eigen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(array_to_matrix) {
}
} else {
// Check that eigen_to_array throws when there is more than one node
BOOST_CHECK_THROW(array_to_eigen(arr), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(array_to_eigen(arr), TiledArray::Exception);

// Fill local tiles with data
GlobalFixture::world->srand(27);
Expand Down Expand Up @@ -370,7 +370,7 @@ BOOST_AUTO_TEST_CASE(array_to_vector) {
}
} else {
// Check that eigen_to_array throws when there is more than one node
BOOST_CHECK_THROW(array_to_eigen(arr1), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(array_to_eigen(arr1), TiledArray::Exception);

// Fill local tiles with data
GlobalFixture::world->srand(27);
Expand Down Expand Up @@ -533,8 +533,8 @@ BOOST_AUTO_TEST_CASE(array_to_tensor) {
if (GlobalFixture::world->size() > 1) {
// Check that array_to_eigen_tensor throws when there is more than one
// node
BOOST_CHECK_THROW(array_to_eigen_tensor<Tensor>(arr),
TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(array_to_eigen_tensor<Tensor>(arr),
TiledArray::Exception);
}

// Distribute the data of arrayN to all nodes
Expand Down
2 changes: 1 addition & 1 deletion tests/expressions_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(assign_subblock_block_base1, F, Fixtures, F) {
// overriding trange of result block is not allowed ... (this is enforced
// by a TA_ASSERT, so the throw only happens when assertions throw)
#if TA_ASSERT_POLICY == TA_ASSERT_THROW
BOOST_REQUIRE_THROW(
BOOST_REQUIRE_TA_ASSERT(
a_block("a,b,c")
.block({0, 0, 0}, {2, 2, 2})
.set_trange_lobound({0, 0, 0}) = a_base1("a,b,c")
Expand Down
6 changes: 3 additions & 3 deletions tests/index_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ BOOST_AUTO_TEST_CASE(accessors) {
BOOST_CHECK_EQUAL(v.at(3), "d"); // check last variable access
BOOST_CHECK_EQUAL(v[0], "a"); // check 1st variable access
BOOST_CHECK_EQUAL(v[3], "d"); // check last variable access
BOOST_CHECK_TA_ASSERT(v.at(4),
BOOST_CHECK_THROW(v.at(4),
#ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
std::out_of_range
std::out_of_range
#else
boost::container::out_of_range
boost::container::out_of_range
#endif
); // check for out of range throw.
}
Expand Down
43 changes: 23 additions & 20 deletions tests/initializer_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ BOOST_AUTO_TEST_CASE(bad_matrix) {
std::array<double, 5> buffer{};
matrix_il<double> il{{1, 2}, {3, 4, 5}};
if (world.rank() == 0) // only rank 0 does the work
BOOST_CHECK_THROW(flatten_il(il, buffer.begin()), Exception);
BOOST_CHECK_TA_ASSERT(flatten_il(il, buffer.begin()), Exception);
}

BOOST_AUTO_TEST_CASE(empty_matrix) {
Expand Down Expand Up @@ -470,8 +470,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(vector, T, scalar_type_list) {
TiledRange tr{{0, 2, 3}};
auto array = array_from_il<TArray<T>>(world, tr, il);
using tile_type = typename TArray<T>::value_type;
std::vector corr{tile_type(tr.make_tile_range(0), {1.0, 2.0}),
tile_type(tr.make_tile_range(1), std::initializer_list<T>{3.0})};
std::vector corr{
tile_type(tr.make_tile_range(0), {1.0, 2.0}),
tile_type(tr.make_tile_range(1), std::initializer_list<T>{3.0})};
for (auto i = 0; i < array.size(); ++i) {
if (!array.is_local(i)) continue;
tile_type tile = array.find(i);
Expand All @@ -484,10 +485,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(matrix, T, scalar_type_list) {
TiledRange tr{{{0, 2, 3}, {0, 1, 3}}};
auto array = array_from_il<TArray<T>>(world, tr, il);
using tile_type = typename TArray<T>::value_type;
std::vector corr{tile_type(tr.make_tile_range(0), {1.0, 4.0}),
tile_type(tr.make_tile_range(1), {2.0, 3.0, 5.0, 6.0}),
tile_type(tr.make_tile_range(2), std::initializer_list<T>{7.0}),
tile_type(tr.make_tile_range(3), {8.0, 9.0})};
std::vector corr{
tile_type(tr.make_tile_range(0), {1.0, 4.0}),
tile_type(tr.make_tile_range(1), {2.0, 3.0, 5.0, 6.0}),
tile_type(tr.make_tile_range(2), std::initializer_list<T>{7.0}),
tile_type(tr.make_tile_range(3), {8.0, 9.0})};
for (auto i = 0; i < array.size(); ++i) {
if (!array.is_local(i)) continue;
tile_type tile = array.find(i);
Expand All @@ -501,14 +503,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(tensor, T, scalar_type_list) {
TiledRange tr{{{0, 1, 2}, {0, 2, 3}, {0, 1, 3}}};
auto array = array_from_il<TArray<T>>(world, tr, il);
using tile_type = typename TArray<T>::value_type;
std::vector corr{tile_type(tr.make_tile_range(0), {1.0, 4.0}),
tile_type(tr.make_tile_range(1), {2.0, 3.0, 5.0, 6.0}),
tile_type(tr.make_tile_range(2), std::initializer_list<T>{7.0}),
tile_type(tr.make_tile_range(3), {8.0, 9.0}),
tile_type(tr.make_tile_range(4), {10.0, 13.0}),
tile_type(tr.make_tile_range(5), {11.0, 12.0, 14.0, 15.0}),
tile_type(tr.make_tile_range(6), std::initializer_list<T>{16.0}),
tile_type(tr.make_tile_range(7), {17.0, 18.0})};
std::vector corr{
tile_type(tr.make_tile_range(0), {1.0, 4.0}),
tile_type(tr.make_tile_range(1), {2.0, 3.0, 5.0, 6.0}),
tile_type(tr.make_tile_range(2), std::initializer_list<T>{7.0}),
tile_type(tr.make_tile_range(3), {8.0, 9.0}),
tile_type(tr.make_tile_range(4), {10.0, 13.0}),
tile_type(tr.make_tile_range(5), {11.0, 12.0, 14.0, 15.0}),
tile_type(tr.make_tile_range(6), std::initializer_list<T>{16.0}),
tile_type(tr.make_tile_range(7), {17.0, 18.0})};
for (auto i = 0; i < array.size(); ++i) {
if (!array.is_local(i)) continue;
tile_type tile = array.find(i);
Expand All @@ -529,7 +532,7 @@ BOOST_AUTO_TEST_CASE(scalar) {
BOOST_AUTO_TEST_CASE_TEMPLATE(empty_vector, T, scalar_type_list) {
vector_il<T> il{};
if (world.rank() == 0) // only rank 0 does the work
BOOST_CHECK_THROW(array_from_il<TArray<T>>(world, il), Exception);
BOOST_CHECK_TA_ASSERT(array_from_il<TArray<T>>(world, il), Exception);
}

BOOST_AUTO_TEST_CASE_TEMPLATE(vector, T, scalar_type_list) {
Expand All @@ -550,13 +553,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(vector, T, scalar_type_list) {
BOOST_AUTO_TEST_CASE_TEMPLATE(empty_matrix, T, scalar_type_list) {
matrix_il<T> il{{}};
if (world.rank() == 0) // only rank 0 does the work
BOOST_CHECK_THROW(array_from_il<TArray<T>>(world, il), Exception);
BOOST_CHECK_TA_ASSERT(array_from_il<TArray<T>>(world, il), Exception);
}

BOOST_AUTO_TEST_CASE_TEMPLATE(bad_matrix, T, scalar_type_list) {
matrix_il<T> il{{1, 2}, {3, 4, 5}};
if (world.rank() == 0) // only rank 0 does the work
BOOST_CHECK_THROW(array_from_il<TArray<T>>(world, il), Exception);
BOOST_CHECK_TA_ASSERT(array_from_il<TArray<T>>(world, il), Exception);
}

BOOST_AUTO_TEST_CASE_TEMPLATE(square_matrix, T, scalar_type_list) {
Expand Down Expand Up @@ -611,13 +614,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(short_matrix, T, scalar_type_list) {
BOOST_AUTO_TEST_CASE_TEMPLATE(empty_rank3, T, scalar_type_list) {
tensor3_il<T> il{{{}}};
if (world.rank() == 0) // only rank 0 does the work
BOOST_CHECK_THROW(array_from_il<TArray<T>>(world, il), Exception);
BOOST_CHECK_TA_ASSERT(array_from_il<TArray<T>>(world, il), Exception);
}

BOOST_AUTO_TEST_CASE_TEMPLATE(bad_rank3, T, scalar_type_list) {
tensor3_il<T> il{{{1, 2}, {3, 4, 5}}};
if (world.rank() == 0) // only rank 0 does the work
BOOST_CHECK_THROW(array_from_il<TArray<T>>(world, il), Exception);
BOOST_CHECK_TA_ASSERT(array_from_il<TArray<T>>(world, il), Exception);
}

BOOST_AUTO_TEST_CASE_TEMPLATE(square_rank3, T, scalar_type_list) {
Expand Down
4 changes: 2 additions & 2 deletions tests/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(constructors) {
BOOST_REQUIRE_NO_THROW(
Range r(ranges::views::zip(p2, f2))); // uses zipped range of p2 and f2

BOOST_CHECK_THROW(Range r2(f2, p2), Exception); // lobound > upbound
BOOST_CHECK_TA_ASSERT(Range r2(f2, p2), Exception); // lobound > upbound
Range r2(p2, f2);
BOOST_CHECK_EQUAL_COLLECTIONS(
r2.lobound_data(), r2.lobound_data() + r2.rank(), p2.begin(), p2.end());
Expand Down Expand Up @@ -639,7 +639,7 @@ BOOST_AUTO_TEST_CASE(include) {
BOOST_CHECK(r.includes_ordinal(o)); // equivalent: see below
}
BOOST_CHECK(!r.includes(o));
BOOST_CHECK_THROW(
BOOST_CHECK_TA_ASSERT(
r_1d.includes(0),
TiledArray::Exception); // for 1-d Range can't distinguish
// includes(integers...) and includes(ordinal)
Expand Down
6 changes: 3 additions & 3 deletions tests/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(default_constructor) {
const_cast<const TensorN&>(x).end());

// check for element access error
BOOST_CHECK_THROW(x[0], Exception);
BOOST_CHECK_TA_ASSERT(x[0], Exception);
}

BOOST_AUTO_TEST_CASE(range_constructor) {
Expand Down Expand Up @@ -408,8 +408,8 @@ BOOST_AUTO_TEST_CASE(element_access) {
#endif

// check out of range error
BOOST_CHECK_THROW(t[r.upbound()], Exception);
BOOST_CHECK_THROW(t[r.volume()], Exception);
BOOST_CHECK_TA_ASSERT(t[r.upbound()], Exception);
BOOST_CHECK_TA_ASSERT(t[r.volume()], Exception);
}

BOOST_AUTO_TEST_CASE(iteration) {
Expand Down
36 changes: 18 additions & 18 deletions tests/tot_dist_array_part1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(find, TestParam, test_params) {
auto upbound = tile_range.upbound();

// Throw if coordinate index is out of bounds
BOOST_CHECK_THROW(t.find(upbound), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.find(upbound), TiledArray::Exception);

// Throw if ordinal index is out of bounds
BOOST_CHECK_THROW(t.find(tile_range.volume()), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.find(tile_range.volume()), TiledArray::Exception);

std::vector<unsigned int> temp(upbound.begin(), upbound.end());
temp.push_back(1);
// Throw if coordinate index has a different rank
BOOST_CHECK_THROW(t.find(temp), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.find(temp), TiledArray::Exception);
}

// Get the 0-th element by ordinate index
Expand Down Expand Up @@ -506,7 +506,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(set_value, TestParam, test_params) {
{
if (m_world.nproc() == 1) {
tensor_type t;
BOOST_CHECK_THROW(t.set(0, inner_type{}), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.set(0, inner_type{}), TiledArray::Exception);
}
}

Expand All @@ -525,17 +525,17 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(set_value, TestParam, test_params) {

// Throw if already initialized
auto& t3 = std::get<2>(tr_t);
BOOST_CHECK_THROW(t3.set(lobound, inner_type{}), except_t);
BOOST_CHECK_TA_ASSERT(t3.set(lobound, inner_type{}), except_t);

// Throw if coordinate index is out of bounds
BOOST_CHECK_THROW(t.set(upbound, inner_type{}), except_t);
BOOST_CHECK_TA_ASSERT(t.set(upbound, inner_type{}), except_t);

// Throw if ordinal index is out of bounds
BOOST_CHECK_THROW(t.set(volume, inner_type{}), except_t);
BOOST_CHECK_TA_ASSERT(t.set(volume, inner_type{}), except_t);

// Throw if coordinate index has a different rank
std::vector<unsigned int> bad_rank(tr.tiles_range().rank() + 1, 0);
BOOST_CHECK_THROW(t.set(bad_rank, inner_type{}), except_t);
BOOST_CHECK_TA_ASSERT(t.set(bad_rank, inner_type{}), except_t);
}

{
Expand Down Expand Up @@ -588,7 +588,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(set_future, TestParam, test_params) {
{
tensor_type<TestParam> t;
if (m_world.nproc() == 1)
BOOST_CHECK_THROW(t.set(0, future_type{}), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.set(0, future_type{}), TiledArray::Exception);
}

for (auto tr_t : run_all<TestParam>()) {
Expand All @@ -606,18 +606,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(set_future, TestParam, test_params) {
future_type f; // Value doesn't matter for throwing

// Throw if tile is already initialized
BOOST_CHECK_THROW(corr.set(0, f), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(corr.set(0, f), TiledArray::Exception);

// Throw if coordinate index is out of bounds
BOOST_CHECK_THROW(t_by_idx.set(upbound, f), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t_by_idx.set(upbound, f), TiledArray::Exception);

// Throw if ordinal index is out of bounds
BOOST_CHECK_THROW(t_by_idx.set(volume, f), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t_by_idx.set(volume, f), TiledArray::Exception);

// Throw if coordinate index has a different rank
std::vector<unsigned int> temp(upbound.begin(), upbound.end());
temp.push_back(0);
BOOST_CHECK_THROW(t_by_idx.set(temp, f), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t_by_idx.set(temp, f), TiledArray::Exception);
}

for (auto tidx : tile_range) {
Expand Down Expand Up @@ -658,7 +658,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(set_tile, TestParam, test_params) {
{
tensor_type<TestParam> t;
if (m_world.nproc() == 1)
BOOST_CHECK_THROW(t.set(0, tile_type{}), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t.set(0, tile_type{}), TiledArray::Exception);
}

for (auto tr_t : run_all<TestParam>()) {
Expand All @@ -676,18 +676,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(set_tile, TestParam, test_params) {
tile_type t; // Value doesn't matter for throwing

// Throw if tile is already initialized
BOOST_CHECK_THROW(corr.set(0, t), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(corr.set(0, t), TiledArray::Exception);

// Throw if coordinate index is out of bounds
BOOST_CHECK_THROW(t_by_idx.set(upbound, t), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t_by_idx.set(upbound, t), TiledArray::Exception);

// Throw if ordinal index is out of bounds
BOOST_CHECK_THROW(t_by_idx.set(volume, t), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t_by_idx.set(volume, t), TiledArray::Exception);

// Throw if coordinate index has a different rank
std::vector<unsigned int> temp(upbound.begin(), upbound.end());
temp.push_back(0);
BOOST_CHECK_THROW(t_by_idx.set(temp, t), TiledArray::Exception);
BOOST_CHECK_TA_ASSERT(t_by_idx.set(temp, t), TiledArray::Exception);
}

for (auto tidx : tile_range) {
Expand Down
Loading
Loading