Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 1990be1

Browse files
author
Sebastien Guiriec
committed
Functional test: Improve Boolean test.
Add missing Boolean type setting test for Blackboard synchronization Signed-off-by: Sebastien Guiriec <[email protected]>
1 parent 1f578f9 commit 1990be1

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

test/functional-tests/Boolean.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ SCENARIO_METHOD(BooleanPF, "Boolean types", "[Boolean types]")
8181
}
8282
}
8383

84+
AND_THEN ("Set/Get boolean type parameter handle") {
85+
ElementHandle handle{*this, path};
86+
/** @FIXME: 'set' operations on a ParameterHandle are silently
87+
* ignored in tuning mode. Does it make sense ? */
88+
REQUIRE_NOTHROW(setTuningMode(false));
89+
90+
for (auto &vec : Tests<bool>{
91+
{"(upper limit)", true}, {"(lower limit)", false},
92+
}) {
93+
GIVEN ("A valid value " + vec.title) {
94+
CHECK_NOTHROW(handle.setAsBoolean(vec.payload));
95+
bool getValueBack;
96+
REQUIRE_NOTHROW(handle.getAsBoolean(getValueBack));
97+
CHECK(getValueBack == vec.payload);
98+
}
99+
}
100+
}
101+
84102
AND_THEN ("Set/Get integer type parameter handle") {
85103
ElementHandle handle{*this, path};
86104
/** @FIXME: 'set' operations on a ParameterHandle are silently

test/functional-tests/include/ElementHandle.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class ElementHandle : private FailureWrapper<::ElementHandle>
7676
/** Wrap EH::getAsDouble to throw an exception on failure. */
7777
void getAsDouble(double &value) const { mayFailCall(&EH::getAsDouble, value); }
7878

79+
void setAsBoolean(bool value) { mayFailCall(&EH::setAsBoolean, value); }
80+
void getAsBoolean(bool &value) const { mayFailCall(&EH::getAsBoolean, value); }
81+
7982
void setAsInteger(uint32_t value) { mayFailCall(&EH::setAsInteger, value); }
8083
void getAsInteger(uint32_t &value) const { mayFailCall(&EH::getAsInteger, value); }
8184
void setAsIntegerArray(const std::vector<uint32_t> &value)

0 commit comments

Comments
 (0)