Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mm318 committed Dec 11, 2019
1 parent eec0dec commit 1e25c44
Showing 1 changed file with 7 additions and 4 deletions.
Expand Up @@ -96,7 +96,7 @@ class PeriodicMeasurementTestFixure : public ::testing::Test
rclcpp::init(0, nullptr);

test_periodic_measurer = std::make_shared<TestPeriodicMeasurementNode>(TEST_NODE_NAME,
test_constants::MEASURE_PERIOD, TEST_TOPIC, INFREQUENT_PUBLISH_PERIOD);
test_constants::MEASURE_PERIOD, TEST_TOPIC, DONT_PUBLISH_DURING_TEST);

ASSERT_FALSE(test_periodic_measurer->isStarted());

Expand All @@ -117,12 +117,15 @@ class PeriodicMeasurementTestFixure : public ::testing::Test
}

protected:
static constexpr std::chrono::milliseconds INFREQUENT_PUBLISH_PERIOD = 2 *
// this test is not designed to have the statistics published and reset at any point of the test,
// so this is defining the publish period to be something amply larger than the test duration
// itself
static constexpr std::chrono::milliseconds DONT_PUBLISH_DURING_TEST = 2 *
test_constants::TEST_DURATION;
std::shared_ptr<TestPeriodicMeasurementNode> test_periodic_measurer;
};

constexpr std::chrono::milliseconds PeriodicMeasurementTestFixure::INFREQUENT_PUBLISH_PERIOD;
constexpr std::chrono::milliseconds PeriodicMeasurementTestFixure::DONT_PUBLISH_DURING_TEST;

TEST_F(PeriodicMeasurementTestFixure, sanity) {
ASSERT_NE(test_periodic_measurer, nullptr);
Expand Down Expand Up @@ -163,7 +166,7 @@ TEST_F(PeriodicMeasurementTestFixure, test_start_and_stop) {

int times_published = test_periodic_measurer->getNumPublished();
ASSERT_EQ(
test_constants::TEST_DURATION.count() / INFREQUENT_PUBLISH_PERIOD.count(), times_published);
test_constants::TEST_DURATION.count() / DONT_PUBLISH_DURING_TEST.count(), times_published);
}

int main(int argc, char ** argv)
Expand Down

0 comments on commit 1e25c44

Please sign in to comment.