From 36497d59d79037f1a2ec9b9cf03c052a8543a05b Mon Sep 17 00:00:00 2001 From: Sebastien Guiriec Date: Mon, 13 Feb 2017 13:06:42 +0100 Subject: [PATCH] Functional test: Improve BitParameter in case of boolean Add BitParamter tests cases for boolean type format. Signed-off-by: Sebastien Guiriec --- test/functional-tests/BitParameter.cpp | 36 +++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/test/functional-tests/BitParameter.cpp b/test/functional-tests/BitParameter.cpp index 8c9d71a55..0a0fb9508 100644 --- a/test/functional-tests/BitParameter.cpp +++ b/test/functional-tests/BitParameter.cpp @@ -45,7 +45,7 @@ namespace parameterFramework const auto validBitParameterInstances = Config{ &Config::instances, // Default for integers is unsigned/32bits - R"()"}; + R"()"}; const auto &invalidBitParameterParameters = Tests{{"Too much bits", "{ + {"(upper limit)", true}, {"(lower limit)", false}, + }) { + GIVEN ("Invalid value " + vec.title) { + CHECK_THROWS_AS(handle.setAsBoolean(vec.payload), Exception); + } + } + } + + AND_THEN ("Set/Get a BitParameter type parameter in boolean") { + path = "/test/test/nominal/bool"; + ElementHandle handle{*this, path}; + /** @FIXME: 'set' operations on a ParameterHandle are silently + * ignored in tuning mode. Does it make sense ? */ + REQUIRE_NOTHROW(setTuningMode(false)); + + for (auto &vec : Tests{ + {"(upper limit)", true}, {"(lower limit)", false}, + }) { + GIVEN ("A valid value " + vec.title) { + CHECK_NOTHROW(handle.setAsBoolean(vec.payload)); + bool getValueBack; + REQUIRE_NOTHROW(handle.getAsBoolean(getValueBack)); + CHECK(getValueBack == vec.payload); + } + } + } } } }