dev: jf sync: stopping master gives idle (#824)

* jf sync mode master could return idle when stopped and so not all modules return the same value and must check for 'stopped or idle', Also must throw if any of the module gives an error

* added contains_only to sls::Result (#827)

* added variadic template for checking if a result contains only specified values

* fix for gcc4.8

* renamed to Result::contains_only

* updated condition in Detector.cpp

* stop on only the positions

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
2023-10-13 15:25:41 +02:00
committed by GitHub
parent d34f396ef8
commit 2b2e50916c
4 changed files with 68 additions and 10 deletions

View File

@ -196,4 +196,24 @@ TEST_CASE("String conversions") {
"[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]");
}
TEST_CASE("Any element is equal"){
Result<int> r{1,2,3,4,5};
REQUIRE(r.any(3));
REQUIRE_FALSE(r.any(9));
}
TEST_CASE("Result contains only the specified elements"){
Result<int> r{1,1,1};
REQUIRE(r.contains_only(1));
REQUIRE(r.contains_only(1,1));
}
TEST_CASE("Only with multiple values"){
Result<int> r{1,1,2,1,2,1,1};
REQUIRE_FALSE(r.contains_only(1));
REQUIRE_FALSE(r.contains_only(2));
REQUIRE(r.contains_only(1,2));
REQUIRE(r.contains_only(2,1));
}
} // namespace sls