EntityManager: Rename BasicVariantType to DBusValueVariant
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ifde3020ee286ee6b98951df4bad5c3bd8d0251d2
diff --git a/include/EntityManager.hpp b/include/EntityManager.hpp
index 540d9a6..eb8a86d 100644
--- a/include/EntityManager.hpp
+++ b/include/EntityManager.hpp
@@ -35,11 +35,11 @@
std::string,
boost::container::flat_map<
std::string,
- boost::container::flat_map<std::string, BasicVariantType>>>;
+ boost::container::flat_map<std::string, DBusValueVariant>>>;
// vector of tuple<map<propertyName, variant>, D-Bus path>>
using FoundDeviceT = std::vector<std::tuple<
- boost::container::flat_map<std::string, BasicVariantType>, std::string>>;
+ boost::container::flat_map<std::string, DBusValueVariant>, std::string>>;
struct CmpStr
{
diff --git a/include/Utils.hpp b/include/Utils.hpp
index eb8b8f1..fa155f9 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -32,7 +32,7 @@
extern boost::asio::io_context io;
-using BasicVariantType =
+using DBusValueVariant =
std::variant<std::string, int64_t, uint64_t, double, int32_t, uint32_t,
int16_t, uint16_t, uint8_t, bool, std::vector<uint8_t>>;
@@ -139,14 +139,14 @@
std::optional<std::string> templateCharReplace(
nlohmann::json::iterator& keyPair,
const boost::container::flat_map<
- std::string, boost::container::flat_map<std::string, BasicVariantType>>&
+ std::string, boost::container::flat_map<std::string, DBusValueVariant>>&
allInterfaces,
const size_t foundDeviceIdx,
const std::optional<std::string>& replaceStr = std::nullopt);
std::optional<std::string> templateCharReplace(
nlohmann::json::iterator& keyPair,
- const boost::container::flat_map<std::string, BasicVariantType>&
+ const boost::container::flat_map<std::string, DBusValueVariant>&
foundDevice,
const size_t foundDeviceIdx,
const std::optional<std::string>& replaceStr = std::nullopt);
@@ -172,4 +172,4 @@
/// \param probe the probe statement to match against.
/// \param dbusValue the property value being matched to a probe.
/// \return true if the dbusValue matched the probe otherwise false.
-bool matchProbe(const nlohmann::json& probe, const BasicVariantType& dbusValue);
+bool matchProbe(const nlohmann::json& probe, const DBusValueVariant& dbusValue);
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 493dbfb..adbf134 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -70,7 +70,7 @@
sdbusplus::message::object_path,
boost::container::flat_map<
std::string,
- boost::container::flat_map<std::string, BasicVariantType>>>;
+ boost::container::flat_map<std::string, DBusValueVariant>>>;
// store reference to all interfaces so we can destroy them later
boost::container::flat_map<
diff --git a/src/PerformProbe.cpp b/src/PerformProbe.cpp
index adf45d6..690ce15 100644
--- a/src/PerformProbe.cpp
+++ b/src/PerformProbe.cpp
@@ -43,7 +43,7 @@
foundProbe = true;
bool deviceMatches = true;
- const boost::container::flat_map<std::string, BasicVariantType>&
+ const boost::container::flat_map<std::string, DBusValueVariant>&
properties = it->second;
for (const auto& [matchProp, matchJSON] : matches)
@@ -197,7 +197,7 @@
if (ret && foundDevs.size() == 0)
{
foundDevs.emplace_back(
- boost::container::flat_map<std::string, BasicVariantType>{},
+ boost::container::flat_map<std::string, DBusValueVariant>{},
std::string{});
}
if (matchOne && ret)
diff --git a/src/PerformScan.cpp b/src/PerformScan.cpp
index dd3e3d4..5d05403 100644
--- a/src/PerformScan.cpp
+++ b/src/PerformScan.cpp
@@ -53,7 +53,7 @@
systemBus->async_method_call(
[call, scan, probeVector, retries](
boost::system::error_code& errc,
- const boost::container::flat_map<std::string, BasicVariantType>&
+ const boost::container::flat_map<std::string, DBusValueVariant>&
resp) {
if (errc)
{
@@ -211,7 +211,7 @@
}
std::string getRecordName(
- const boost::container::flat_map<std::string, BasicVariantType>& probe,
+ const boost::container::flat_map<std::string, DBusValueVariant>& probe,
const std::string& probeName)
{
if (probe.empty())
@@ -379,14 +379,14 @@
std::optional<std::string> replaceStr;
MapperGetSubTreeResponse::mapped_type emptyInterfaces;
- boost::container::flat_map<std::string, BasicVariantType>
+ boost::container::flat_map<std::string, DBusValueVariant>
emptyProps;
emptyInterfaces.emplace(std::string{}, emptyProps);
for (auto& foundDeviceAndPath : foundDevices)
{
const boost::container::flat_map<
- std::string, BasicVariantType>& foundDevice =
+ std::string, DBusValueVariant>& foundDevice =
std::get<0>(foundDeviceAndPath);
const std::string& path = std::get<1>(foundDeviceAndPath);
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 31a10bc..48c04fa 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -190,7 +190,7 @@
std::optional<std::string> templateCharReplace(
nlohmann::json::iterator& keyPair,
const boost::container::flat_map<
- std::string, boost::container::flat_map<std::string, BasicVariantType>>&
+ std::string, boost::container::flat_map<std::string, DBusValueVariant>>&
allInterfaces,
const size_t foundDeviceIdx, const std::optional<std::string>& replaceStr)
{
@@ -211,7 +211,7 @@
// ADDRESS field from a object on dbus
std::optional<std::string> templateCharReplace(
nlohmann::json::iterator& keyPair,
- const boost::container::flat_map<std::string, BasicVariantType>&
+ const boost::container::flat_map<std::string, DBusValueVariant>&
foundDevice,
const size_t foundDeviceIdx, const std::optional<std::string>& replaceStr)
{
@@ -456,7 +456,7 @@
/// \brief JSON/DBus matching Callable for std::variant (visitor)
///
/// Default match JSON/DBus match implementation
-/// \tparam T The concrete DBus value type from BasicVariantType
+/// \tparam T The concrete DBus value type from DBusValueVariant
template <typename T>
struct MatchProbe
{
@@ -517,7 +517,7 @@
}
};
-bool matchProbe(const nlohmann::json& probe, const BasicVariantType& dbusValue)
+bool matchProbe(const nlohmann::json& probe, const DBusValueVariant& dbusValue)
{
return std::visit(MatchProbeForwarder(probe), dbusValue);
}
diff --git a/test/test_entity-manager.cpp b/test/test_entity-manager.cpp
index deaf06c..fbef838 100644
--- a/test/test_entity-manager.cpp
+++ b/test/test_entity-manager.cpp
@@ -14,7 +14,7 @@
{
nlohmann::json j = {{"foo", "$bus"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["BUS"] = 23;
templateCharReplace(it, data, 0);
@@ -27,7 +27,7 @@
{
nlohmann::json j = {{"foo", "$TEST"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = std::string("Test");
templateCharReplace(it, data, 0);
@@ -40,7 +40,7 @@
{
nlohmann::json j = {{"foo", "the $TEST"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = std::string("Test");
templateCharReplace(it, data, 0);
@@ -53,7 +53,7 @@
{
nlohmann::json j = {{"foo", "the $TEST worked"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = std::string("Test");
templateCharReplace(it, data, 0);
@@ -66,7 +66,7 @@
{
nlohmann::json j = {{"foo", "the Test $TEST"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 23;
templateCharReplace(it, data, 0);
@@ -79,7 +79,7 @@
{
nlohmann::json j = {{"foo", "3 plus 1 equals $TEST + 1"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 3;
templateCharReplace(it, data, 0);
@@ -92,7 +92,7 @@
{
nlohmann::json j = {{"foo", "3 minus 1 equals $TEST - 1 !"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 3;
templateCharReplace(it, data, 0);
@@ -105,7 +105,7 @@
{
nlohmann::json j = {{"foo", "3 mod 2 equals $TEST % 2"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 3;
templateCharReplace(it, data, 0);
@@ -118,7 +118,7 @@
{
nlohmann::json j = {{"foo", "3 * 2 equals $TEST * 2"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 3;
templateCharReplace(it, data, 0);
@@ -131,7 +131,7 @@
{
nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 4;
templateCharReplace(it, data, 0);
@@ -144,7 +144,7 @@
{
nlohmann::json j = {{"foo", "4 * 2 % 6 equals $TEST * 2 % 6"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 4;
templateCharReplace(it, data, 0);
@@ -157,7 +157,7 @@
{
nlohmann::json j = {{"foo", "$FOO $BAR"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["FOO"] = std::string("foo");
data["BAR"] = std::string("bar");
@@ -171,7 +171,7 @@
{
nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2 $BAR"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["TEST"] = 4;
data["BAR"] = std::string("bar");
@@ -184,7 +184,7 @@
{
nlohmann::json j = {{"foo", "4 / 2 equals $ADDRESS / 2 $BAR"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["ADDRESS"] = 4;
data["BAR"] = std::string("bar");
@@ -201,7 +201,7 @@
{"Name", "$bus sensor 0"},
{"Type", "SomeType"}};
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["BUS"] = 15;
for (auto it = j.begin(); it != j.end(); it++)
@@ -219,7 +219,7 @@
{
nlohmann::json j = {{"foo", "twelve is $TEST"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
data["test"] = 12;
templateCharReplace(it, data, 0);
@@ -232,7 +232,7 @@
{
nlohmann::json j = {{"foo", "0x54"}};
auto it = j.begin();
- boost::container::flat_map<std::string, BasicVariantType> data;
+ boost::container::flat_map<std::string, DBusValueVariant> data;
templateCharReplace(it, data, 0);
@@ -243,642 +243,642 @@
TEST(MatchProbe, stringEqString)
{
nlohmann::json j = R"("foo")"_json;
- BasicVariantType v = "foo"s;
+ DBusValueVariant v = "foo"s;
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, stringRegexEqString)
{
nlohmann::json j = R"("foo*")"_json;
- BasicVariantType v = "foobar"s;
+ DBusValueVariant v = "foobar"s;
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqString)
{
nlohmann::json j = R"("foobar")"_json;
- BasicVariantType v = "foo"s;
+ DBusValueVariant v = "foo"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringRegexError)
{
nlohmann::json j = R"("foo[")"_json;
- BasicVariantType v = "foobar"s;
+ DBusValueVariant v = "foobar"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringZeroNeqFalse)
{
nlohmann::json j = R"("0")"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringOneNeqTrue)
{
nlohmann::json j = R"("1")"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringElevenNeqTrue)
{
nlohmann::json j = R"("11")"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringFalseNeqFalse)
{
nlohmann::json j = R"("false")"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringTrueNeqTrue)
{
nlohmann::json j = R"("true")"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringFalseNeqTrue)
{
nlohmann::json j = R"("false")"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqUint8)
{
nlohmann::json j = R"("255")"_json;
- BasicVariantType v = uint8_t(255);
+ DBusValueVariant v = uint8_t(255);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqUint8Overflow)
{
nlohmann::json j = R"("65535")"_json;
- BasicVariantType v = uint8_t(255);
+ DBusValueVariant v = uint8_t(255);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringFalseNeqUint8Zero)
{
nlohmann::json j = R"("false")"_json;
- BasicVariantType v = uint8_t(0);
+ DBusValueVariant v = uint8_t(0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringTrueNeqUint8Zero)
{
nlohmann::json j = R"("true")"_json;
- BasicVariantType v = uint8_t(1);
+ DBusValueVariant v = uint8_t(1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqUint32)
{
nlohmann::json j = R"("11")"_json;
- BasicVariantType v = uint32_t(11);
+ DBusValueVariant v = uint32_t(11);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqInt32)
{
nlohmann::json j = R"("-11")"_json;
- BasicVariantType v = int32_t(-11);
+ DBusValueVariant v = int32_t(-11);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringRegexNeqInt32)
{
nlohmann::json j = R"("1*4")"_json;
- BasicVariantType v = int32_t(124);
+ DBusValueVariant v = int32_t(124);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqUint64)
{
nlohmann::json j = R"("foo")"_json;
- BasicVariantType v = uint64_t(65535);
+ DBusValueVariant v = uint64_t(65535);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqDouble)
{
nlohmann::json j = R"("123.4")"_json;
- BasicVariantType v = double(123.4);
+ DBusValueVariant v = double(123.4);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqEmpty)
{
nlohmann::json j = R"("-123.4")"_json;
- BasicVariantType v;
+ DBusValueVariant v;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, stringNeqArray)
{
nlohmann::json j = R"("-123.4")"_json;
- BasicVariantType v = std::vector<uint8_t>{1, 2};
+ DBusValueVariant v = std::vector<uint8_t>{1, 2};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, boolNeqString)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v = "false"s;
+ DBusValueVariant v = "false"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueEqTrue)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, falseEqFalse)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqFalse)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqInt32Zero)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = int32_t(0);
+ DBusValueVariant v = int32_t(0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqInt32NegativeOne)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = int32_t(-1);
+ DBusValueVariant v = int32_t(-1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, falseNeqUint32One)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v = uint32_t(1);
+ DBusValueVariant v = uint32_t(1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, falseNeqUint32Zero)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v = uint32_t(0);
+ DBusValueVariant v = uint32_t(0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqDoubleNegativeOne)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = double(-1.1);
+ DBusValueVariant v = double(-1.1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqDoubleOne)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = double(1.0);
+ DBusValueVariant v = double(1.0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, falseNeqDoubleOne)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v = double(1.0);
+ DBusValueVariant v = double(1.0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, falseNeqDoubleZero)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v = double(0.0);
+ DBusValueVariant v = double(0.0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, falseNeqEmpty)
{
nlohmann::json j = R"(false)"_json;
- BasicVariantType v;
+ DBusValueVariant v;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqEmpty)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v;
+ DBusValueVariant v;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, trueNeqArray)
{
nlohmann::json j = R"(true)"_json;
- BasicVariantType v = std::vector<uint8_t>{1, 2};
+ DBusValueVariant v = std::vector<uint8_t>{1, 2};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqString)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = "11"s;
+ DBusValueVariant v = "11"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqTrue)
{
nlohmann::json j = R"(1)"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqFalse)
{
nlohmann::json j = R"(0)"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintEqUint8)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = uint8_t(11);
+ DBusValueVariant v = uint8_t(11);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqUint8)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = uint8_t(12);
+ DBusValueVariant v = uint8_t(12);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqUint8Overflow)
{
nlohmann::json j = R"(65535)"_json;
- BasicVariantType v = uint8_t(255);
+ DBusValueVariant v = uint8_t(255);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintEqInt8)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = int8_t(11);
+ DBusValueVariant v = int8_t(11);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, uintEqDouble)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = double(11.0);
+ DBusValueVariant v = double(11.0);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqDouble)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = double(11.7);
+ DBusValueVariant v = double(11.7);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqEmpty)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v;
+ DBusValueVariant v;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, uintNeqArray)
{
nlohmann::json j = R"(11)"_json;
- BasicVariantType v = std::vector<uint8_t>{11};
+ DBusValueVariant v = std::vector<uint8_t>{11};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqString)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v = "-11"s;
+ DBusValueVariant v = "-11"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqTrue)
{
nlohmann::json j = R"(-1)"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqUint8)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v = uint8_t(11);
+ DBusValueVariant v = uint8_t(11);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intEqInt8)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v = int8_t(-11);
+ DBusValueVariant v = int8_t(-11);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqDouble)
{
nlohmann::json j = R"(-124)"_json;
- BasicVariantType v = double(-123.0);
+ DBusValueVariant v = double(-123.0);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intEqDouble)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v = double(-11.0);
+ DBusValueVariant v = double(-11.0);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqDoubleRound)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v = double(-11.7);
+ DBusValueVariant v = double(-11.7);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqEmpty)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v;
+ DBusValueVariant v;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, intNeqArray)
{
nlohmann::json j = R"(-11)"_json;
- BasicVariantType v = std::vector<uint8_t>{11};
+ DBusValueVariant v = std::vector<uint8_t>{11};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqString)
{
nlohmann::json j = R"(0.0)"_json;
- BasicVariantType v = "0.0"s;
+ DBusValueVariant v = "0.0"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqFalse)
{
nlohmann::json j = R"(0.0)"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqTrue)
{
nlohmann::json j = R"(1.0)"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleEqInt32)
{
nlohmann::json j = R"(-124.0)"_json;
- BasicVariantType v = int32_t(-124);
+ DBusValueVariant v = int32_t(-124);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqInt32)
{
nlohmann::json j = R"(-124.0)"_json;
- BasicVariantType v = int32_t(-123);
+ DBusValueVariant v = int32_t(-123);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleRoundNeqInt)
{
nlohmann::json j = R"(124.7)"_json;
- BasicVariantType v = int32_t(124);
+ DBusValueVariant v = int32_t(124);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleEqDouble)
{
nlohmann::json j = R"(-124.2)"_json;
- BasicVariantType v = double(-124.2);
+ DBusValueVariant v = double(-124.2);
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqDouble)
{
nlohmann::json j = R"(-124.3)"_json;
- BasicVariantType v = double(-124.2);
+ DBusValueVariant v = double(-124.2);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqEmpty)
{
nlohmann::json j = R"(-11.0)"_json;
- BasicVariantType v;
+ DBusValueVariant v;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, doubleNeqArray)
{
nlohmann::json j = R"(-11.2)"_json;
- BasicVariantType v = std::vector<uint8_t>{11};
+ DBusValueVariant v = std::vector<uint8_t>{11};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqString)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = "hello"s;
+ DBusValueVariant v = "hello"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqFalse)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqTrue)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqUint8)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = uint8_t(1);
+ DBusValueVariant v = uint8_t(1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqInt32)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = int32_t(-1);
+ DBusValueVariant v = int32_t(-1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqDouble)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = double(1.1);
+ DBusValueVariant v = double(1.1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayEqArray)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = std::vector<uint8_t>{1, 2};
+ DBusValueVariant v = std::vector<uint8_t>{1, 2};
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqArrayDiffSize1)
{
nlohmann::json j = R"([1, 2, 3])"_json;
- BasicVariantType v = std::vector<uint8_t>{1, 2};
+ DBusValueVariant v = std::vector<uint8_t>{1, 2};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqArrayDiffSize2)
{
nlohmann::json j = R"([1, 2])"_json;
- BasicVariantType v = std::vector<uint8_t>{1, 2, 3};
+ DBusValueVariant v = std::vector<uint8_t>{1, 2, 3};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, emptyArrayEqEmptyArray)
{
nlohmann::json j = R"([])"_json;
- BasicVariantType v = std::vector<uint8_t>{};
+ DBusValueVariant v = std::vector<uint8_t>{};
EXPECT_TRUE(matchProbe(j, v));
}
TEST(MatchProbe, emptyArrayNeqArray)
{
nlohmann::json j = R"([])"_json;
- BasicVariantType v = std::vector<uint8_t>{1};
+ DBusValueVariant v = std::vector<uint8_t>{1};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, arrayNeqEmptyArray)
{
nlohmann::json j = R"([1])"_json;
- BasicVariantType v = std::vector<uint8_t>{};
+ DBusValueVariant v = std::vector<uint8_t>{};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqString)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = "hello"s;
+ DBusValueVariant v = "hello"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqFalse)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqTrue)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqUint8)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = uint8_t(1);
+ DBusValueVariant v = uint8_t(1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqInt32)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = int32_t(-1);
+ DBusValueVariant v = int32_t(-1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqDouble)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = double(1.1);
+ DBusValueVariant v = double(1.1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, objNeqArray)
{
nlohmann::json j = R"({"foo": "bar"})"_json;
- BasicVariantType v = std::vector<uint8_t>{1, 2};
+ DBusValueVariant v = std::vector<uint8_t>{1, 2};
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqString)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = "hello"s;
+ DBusValueVariant v = "hello"s;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqFalse)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = false;
+ DBusValueVariant v = false;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqTrue)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = true;
+ DBusValueVariant v = true;
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqUint8)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = uint8_t(1);
+ DBusValueVariant v = uint8_t(1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqInt32)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = int32_t(-1);
+ DBusValueVariant v = int32_t(-1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqDouble)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = double(1.1);
+ DBusValueVariant v = double(1.1);
EXPECT_FALSE(matchProbe(j, v));
}
TEST(MatchProbe, nullNeqArray)
{
nlohmann::json j = R"(null)"_json;
- BasicVariantType v = std::vector<uint8_t>{};
+ DBusValueVariant v = std::vector<uint8_t>{};
EXPECT_FALSE(matchProbe(j, v));
}