Skip to content

Commit

Permalink
Merge pull request #1068 from DARMA-tasking/1060-model-testing
Browse files Browse the repository at this point in the history
#1060 Don't allow sloppy mis-construction of PhaseOffset
  • Loading branch information
PhilMiller authored Sep 21, 2020
2 parents 0bfd3aa + e6fd2fd commit 1c22e6a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/vt/vrt/collection/balance/model/load_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ namespace vt { namespace vrt { namespace collection { namespace balance {
* represent more distant future phases.
*/
struct PhaseOffset {
PhaseOffset() = delete;

int phases;
static constexpr unsigned int NEXT_PHASE = 0;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/collection/test_model_linear_model.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ TEST_F(TestLinearModel, test_model_linear_model_1) {
++num_phases;

for (auto&& obj : *test_model) {
auto work_val = test_model->getWork(obj, PhaseOffset{});
auto work_val = test_model->getWork(obj, {PhaseOffset::NEXT_PHASE, PhaseOffset::WHOLE_PHASE});
EXPECT_EQ(
work_val,
obj == 1 ? expected_data[iter].first : expected_data[iter].second)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/collection/test_model_multiple_phases.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST_F(TestModelMultiplePhases, test_model_multiple_phases_1) {
test_model->updateLoads(3);

for (auto&& obj : *test_model) {
auto work_val = test_model->getWork(obj, PhaseOffset{});
auto work_val = test_model->getWork(obj, {PhaseOffset::NEXT_PHASE, PhaseOffset::WHOLE_PHASE});
EXPECT_EQ(work_val, obj == 1 ? TimeType{100} : TimeType{85});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ TEST_F(TestModelPerCollection, test_model_per_collection_1) {
// model to function
model->updateLoads(0);
for (auto&& obj : *model) {
auto work_val = model->getWork(obj, PhaseOffset{});
auto work_val = model->getWork(obj, {PhaseOffset::NEXT_PHASE, PhaseOffset::WHOLE_PHASE});
EXPECT_EQ(work_val, static_cast<TimeType>(id_proxy_map[obj]));
//fmt::print("{:x} {}\n", obj, work_val);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ TEST_F(TestModelPersistenceMedianLastN, test_model_persistence_median_last_n_1)
++num_phases;

for (auto&& obj : *test_model) {
auto work_val = test_model->getWork(obj, PhaseOffset{});
auto work_val = test_model->getWork(obj, {PhaseOffset::NEXT_PHASE, PhaseOffset::WHOLE_PHASE});
EXPECT_EQ(
work_val,
obj == 1 ? expected_medians[iter].first : expected_medians[iter].second)
Expand Down

0 comments on commit 1c22e6a

Please sign in to comment.