Signed-off-by: Jannik Abbenseth <jannik.abbenseth@ipa.fraunhofer.de> Co-authored-by: Jannik Abbenseth <ipa-jba@users.noreply.github.com>
This commit is contained in:
parent
27e59d930a
commit
75f3d54d57
3 changed files with 10 additions and 0 deletions
|
@ -77,6 +77,9 @@ public:
|
||||||
bool
|
bool
|
||||||
operator==(const rclcpp::Duration & rhs) const;
|
operator==(const rclcpp::Duration & rhs) const;
|
||||||
|
|
||||||
|
bool
|
||||||
|
operator!=(const rclcpp::Duration & rhs) const;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator<(const rclcpp::Duration & rhs) const;
|
operator<(const rclcpp::Duration & rhs) const;
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,12 @@ Duration::operator==(const rclcpp::Duration & rhs) const
|
||||||
return rcl_duration_.nanoseconds == rhs.rcl_duration_.nanoseconds;
|
return rcl_duration_.nanoseconds == rhs.rcl_duration_.nanoseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Duration::operator!=(const rclcpp::Duration & rhs) const
|
||||||
|
{
|
||||||
|
return rcl_duration_.nanoseconds != rhs.rcl_duration_.nanoseconds;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Duration::operator<(const rclcpp::Duration & rhs) const
|
Duration::operator<(const rclcpp::Duration & rhs) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,7 @@ TEST(TestDuration, operators) {
|
||||||
EXPECT_TRUE(old <= young);
|
EXPECT_TRUE(old <= young);
|
||||||
EXPECT_TRUE(young >= old);
|
EXPECT_TRUE(young >= old);
|
||||||
EXPECT_FALSE(young == old);
|
EXPECT_FALSE(young == old);
|
||||||
|
EXPECT_TRUE(young != old);
|
||||||
|
|
||||||
rclcpp::Duration add = old + young;
|
rclcpp::Duration add = old + young;
|
||||||
EXPECT_EQ(add.nanoseconds(), old.nanoseconds() + young.nanoseconds());
|
EXPECT_EQ(add.nanoseconds(), old.nanoseconds() + young.nanoseconds());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue