@@ -45,7 +45,7 @@ namespace parameterFramework
4545const auto validBitParameterInstances = Config{
4646 &Config::instances,
4747 // Default for integers is unsigned/32bits
48- R"( <BitParameterBlock Name="nominal" Size="16"><BitParameter Pos="1" Size="2" Name="twobits"/><BitParameter Pos="3" Size="3" Max="6" Name="treebits"/></BitParameterBlock>)" };
48+ R"( <BitParameterBlock Name="nominal" Size="16"><BitParameter Pos="0" Size="1" Name="bool"/><BitParameter Pos=" 1" Size="2" Name="twobits"/><BitParameter Pos="3" Size="3" Max="6" Name="treebits"/></BitParameterBlock>)" };
4949
5050const auto &invalidBitParameterParameters =
5151 Tests<string>{{" Too much bits" , " <BitParameterBlock Name='toomuchbits' Size='8'><BitParameter "
@@ -124,6 +124,40 @@ SCENARIO_METHOD(BitParameterPF, "BitParameter types", "[BitParameter types]")
124124 }
125125 }
126126 }
127+
128+ AND_THEN (" Set/Get a BitParameter type parameter in boolean" ) {
129+ ElementHandle handle{*this , path};
130+ /* * @FIXME: 'set' operations on a ParameterHandle are silently
131+ * ignored in tuning mode. Does it make sense ? */
132+ REQUIRE_NOTHROW (setTuningMode (false ));
133+
134+ for (auto &vec : Tests<bool >{
135+ {" (upper limit)" , true }, {" (lower limit)" , false },
136+ }) {
137+ GIVEN (" Invalid value " + vec.title ) {
138+ CHECK_THROWS_AS (handle.setAsBoolean (vec.payload ), Exception);
139+ }
140+ }
141+ }
142+
143+ AND_THEN (" Set/Get a BitParameter type parameter in boolean" ) {
144+ path = " /test/test/nominal/bool" ;
145+ ElementHandle handle{*this , path};
146+ /* * @FIXME: 'set' operations on a ParameterHandle are silently
147+ * ignored in tuning mode. Does it make sense ? */
148+ REQUIRE_NOTHROW (setTuningMode (false ));
149+
150+ for (auto &vec : Tests<bool >{
151+ {" (upper limit)" , true }, {" (lower limit)" , false },
152+ }) {
153+ GIVEN (" A valid value " + vec.title ) {
154+ CHECK_NOTHROW (handle.setAsBoolean (vec.payload ));
155+ bool getValueBack;
156+ REQUIRE_NOTHROW (handle.getAsBoolean (getValueBack));
157+ CHECK (getValueBack == vec.payload );
158+ }
159+ }
160+ }
127161 }
128162 }
129163}
0 commit comments