mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
Add tests for property conversions and subscriptions
This commit is contained in:
parent
7486249c1e
commit
4cefb9fb5b
|
@ -32,6 +32,28 @@ ostream& operator<<(ostream& os, const vector<T>& v)
|
|||
return os;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& os, const vector<signed char>& v)
|
||||
{
|
||||
for (unsigned int i = 0; i < v.size(); ++i) {
|
||||
os << to_string(v[i]);
|
||||
if (i != v.size() - 1) {
|
||||
os << ", ";
|
||||
}
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& os, const vector<unsigned char>& v)
|
||||
{
|
||||
for (unsigned int i = 0; i < v.size(); ++i) {
|
||||
os << to_string(v[i]);
|
||||
if (i != v.size() - 1) {
|
||||
os << ", ";
|
||||
}
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
pair<string, string> getString(const boost::any& v, const string& label)
|
||||
{
|
||||
|
@ -49,31 +71,27 @@ pair<string, string> getStringPair(const boost::any& v, const string& label)
|
|||
|
||||
unordered_map<type_index, function<pair<string, string>(const Property&)>> PropertyHelper::fTypeInfos = {
|
||||
{ type_index(typeid(char)), [](const Property& p) { return pair<string, string>{ string(1, any_cast<char>(p)), "char" }; } },
|
||||
{ type_index(typeid(unsigned char)), [](const Property& p) { return pair<string, string>{ string(1, any_cast<unsigned char>(p)), "unsigned char" }; } },
|
||||
{ type_index(typeid(signed char)), [](const Property& p) { return getString<signed char>(p, "signed char"); } },
|
||||
{ type_index(typeid(unsigned char)), [](const Property& p) { return getString<unsigned char>(p, "unsigned char"); } },
|
||||
{ type_index(typeid(const char*)), [](const Property& p) { return pair<string, string>{ string(any_cast<const char*>(p)), "string" }; } },
|
||||
{ type_index(typeid(string)), [](const Property& p) { return pair<string, string>{ any_cast<string>(p), "string" }; } },
|
||||
{ type_index(typeid(int)), [](const Property& p) { return getString<int>(p, "int"); } },
|
||||
{ type_index(typeid(size_t)), [](const Property& p) { return getString<size_t>(p, "size_t"); } },
|
||||
{ type_index(typeid(uint32_t)), [](const Property& p) { return getString<uint32_t>(p, "uint32_t"); } },
|
||||
{ type_index(typeid(uint64_t)), [](const Property& p) { return getString<uint64_t>(p, "uint64_t"); } },
|
||||
{ type_index(typeid(long)), [](const Property& p) { return getString<long>(p, "long"); } },
|
||||
{ type_index(typeid(long long)), [](const Property& p) { return getString<long long>(p, "long long"); } },
|
||||
{ type_index(typeid(unsigned)), [](const Property& p) { return getString<unsigned>(p, "unsigned"); } },
|
||||
{ type_index(typeid(unsigned long)), [](const Property& p) { return getString<unsigned long>(p, "unsigned long"); } },
|
||||
{ type_index(typeid(unsigned long long)), [](const Property& p) { return getString<unsigned long long>(p, "unsigned long long"); } },
|
||||
{ type_index(typeid(float)), [](const Property& p) { return getString<float>(p, "float"); } },
|
||||
{ type_index(typeid(double)), [](const Property& p) { return getString<double>(p, "double"); } },
|
||||
{ type_index(typeid(long double)), [](const Property& p) { return getString<long double>(p, "long double"); } },
|
||||
{ type_index(typeid(float)), [](const Property& p) { return getStringPair<float>(p, "float"); } },
|
||||
{ type_index(typeid(double)), [](const Property& p) { return getStringPair<double>(p, "double"); } },
|
||||
{ type_index(typeid(long double)), [](const Property& p) { return getStringPair<long double>(p, "long double"); } },
|
||||
{ type_index(typeid(bool)), [](const Property& p) { stringstream ss; ss << boolalpha << any_cast<bool>(p); return pair<string, string>{ ss.str(), "bool" }; } },
|
||||
{ type_index(typeid(vector<bool>)), [](const Property& p) { stringstream ss; ss << boolalpha << any_cast<vector<bool>>(p); return pair<string, string>{ ss.str(), "vector<bool>>" }; } },
|
||||
{ type_index(typeid(boost::filesystem::path)), [](const Property& p) { return getStringPair<boost::filesystem::path>(p, "boost::filesystem::path"); } },
|
||||
{ type_index(typeid(vector<char>)), [](const Property& p) { return getStringPair<vector<char>>(p, "vector<char>"); } },
|
||||
{ type_index(typeid(vector<signed char>)), [](const Property& p) { return getStringPair<vector<signed char>>(p, "vector<signed char>"); } },
|
||||
{ type_index(typeid(vector<unsigned char>)), [](const Property& p) { return getStringPair<vector<unsigned char>>(p, "vector<unsigned char>"); } },
|
||||
{ type_index(typeid(vector<string>)), [](const Property& p) { return getStringPair<vector<string>>(p, "vector<string>"); } },
|
||||
{ type_index(typeid(vector<int>)), [](const Property& p) { return getStringPair<vector<int>>(p, "vector<int>"); } },
|
||||
{ type_index(typeid(vector<size_t>)), [](const Property& p) { return getStringPair<vector<size_t>>(p, "vector<size_t>"); } },
|
||||
{ type_index(typeid(vector<uint32_t>)), [](const Property& p) { return getStringPair<vector<uint32_t>>(p, "vector<uint32_t>"); } },
|
||||
{ type_index(typeid(vector<uint64_t>)), [](const Property& p) { return getStringPair<vector<uint64_t>>(p, "vector<uint64_t>"); } },
|
||||
{ type_index(typeid(vector<long>)), [](const Property& p) { return getStringPair<vector<long>>(p, "vector<long>"); } },
|
||||
{ type_index(typeid(vector<long long>)), [](const Property& p) { return getStringPair<vector<long long>>(p, "vector<long long>"); } },
|
||||
{ type_index(typeid(vector<unsigned>)), [](const Property& p) { return getStringPair<vector<unsigned>>(p, "vector<unsigned>"); } },
|
||||
|
@ -87,13 +105,11 @@ unordered_map<type_index, function<pair<string, string>(const Property&)>> Prope
|
|||
|
||||
unordered_map<type_index, void(*)(const EventManager&, const string&, const Property&)> PropertyHelper::fEventEmitters = {
|
||||
{ type_index(typeid(char)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, char>(k, any_cast<char>(p)); } },
|
||||
{ type_index(typeid(signed char)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, signed char>(k, any_cast<signed char>(p)); } },
|
||||
{ type_index(typeid(unsigned char)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, unsigned char>(k, any_cast<unsigned char>(p)); } },
|
||||
{ type_index(typeid(const char*)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, string>(k, string(any_cast<const char*>(p))); } },
|
||||
{ type_index(typeid(string)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, string>(k, any_cast<string>(p)); } },
|
||||
{ type_index(typeid(int)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, int>(k, any_cast<int>(p)); } },
|
||||
{ type_index(typeid(size_t)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, size_t>(k, any_cast<size_t>(p)); } },
|
||||
{ type_index(typeid(uint32_t)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, uint32_t>(k, any_cast<uint32_t>(p)); } },
|
||||
{ type_index(typeid(uint64_t)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, uint64_t>(k, any_cast<uint64_t>(p)); } },
|
||||
{ type_index(typeid(long)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, long>(k, any_cast<long>(p)); } },
|
||||
{ type_index(typeid(long long)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, long long>(k, any_cast<long long>(p)); } },
|
||||
{ type_index(typeid(unsigned)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, unsigned>(k, any_cast<unsigned>(p)); } },
|
||||
|
@ -106,12 +122,10 @@ unordered_map<type_index, void(*)(const EventManager&, const string&, const Prop
|
|||
{ type_index(typeid(vector<bool>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<bool>>(k, any_cast<vector<bool>>(p)); } },
|
||||
{ type_index(typeid(boost::filesystem::path)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, boost::filesystem::path>(k, any_cast<boost::filesystem::path>(p)); } },
|
||||
{ type_index(typeid(vector<char>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<char>>(k, any_cast<vector<char>>(p)); } },
|
||||
{ type_index(typeid(vector<signed char>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<signed char>>(k, any_cast<vector<signed char>>(p)); } },
|
||||
{ type_index(typeid(vector<unsigned char>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<unsigned char>>(k, any_cast<vector<unsigned char>>(p)); } },
|
||||
{ type_index(typeid(vector<string>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<string>>(k, any_cast<vector<string>>(p)); } },
|
||||
{ type_index(typeid(vector<int>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<int>>(k, any_cast<vector<int>>(p)); } },
|
||||
{ type_index(typeid(vector<size_t>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<size_t>>(k, any_cast<vector<size_t>>(p)); } },
|
||||
{ type_index(typeid(vector<uint32_t>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<uint32_t>>(k, any_cast<vector<uint32_t>>(p)); } },
|
||||
{ type_index(typeid(vector<uint64_t>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<uint64_t>>(k, any_cast<vector<uint64_t>>(p)); } },
|
||||
{ type_index(typeid(vector<long>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<long>>(k, any_cast<vector<long>>(p)); } },
|
||||
{ type_index(typeid(vector<long long>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<long long>>(k, any_cast<vector<long long>>(p)); } },
|
||||
{ type_index(typeid(vector<unsigned>)), [](const EventManager& em, const string& k, const Property& p) { em.Emit<PropertyChange, vector<unsigned>>(k, any_cast<vector<unsigned>>(p)); } },
|
||||
|
|
|
@ -197,6 +197,17 @@ add_testsuite(EventManager
|
|||
TIMEOUT 5
|
||||
)
|
||||
|
||||
add_testsuite(Properties
|
||||
SOURCES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||
properties/_properties.cxx
|
||||
|
||||
LINKS FairMQ
|
||||
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
TIMEOUT 5
|
||||
)
|
||||
|
||||
# add_testsuite(StateMachine
|
||||
# SOURCES
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||
|
|
174
test/properties/_properties.cxx
Normal file
174
test/properties/_properties.cxx
Normal file
|
@ -0,0 +1,174 @@
|
|||
/********************************************************************************
|
||||
* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* *
|
||||
* This software is distributed under the terms of the *
|
||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <fairmq/EventManager.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct TestEvent : fair::mq::Event<const std::string&> {};
|
||||
|
||||
TEST(Properties, ConversionToString)
|
||||
{
|
||||
fair::mq::ProgOptions o;
|
||||
o.SetProperty<char>("_char", 'a');
|
||||
o.SetProperty<signed char>("_signed char", -2);
|
||||
o.SetProperty<unsigned char>("_unsigned char", 2);
|
||||
o.SetProperty<const char*>("_const char*", "testcstring");
|
||||
o.SetProperty<string>("_string", "teststring");
|
||||
o.SetProperty<int>("_int", 1);
|
||||
o.SetProperty<size_t>("_size_t", 11);
|
||||
o.SetProperty<uint32_t>("_uint32_t", 12);
|
||||
o.SetProperty<uint64_t>("_uint64_t", 123);
|
||||
o.SetProperty<long>("_long", 1234);
|
||||
o.SetProperty<long long>("_long long", 12345);
|
||||
o.SetProperty<unsigned>("_unsigned", 3);
|
||||
o.SetProperty<unsigned long>("_unsigned long", 32);
|
||||
o.SetProperty<unsigned long long>("_unsigned long long", 321);
|
||||
o.SetProperty<float>("_float", 3.2);
|
||||
o.SetProperty<double>("_double", 33.22);
|
||||
o.SetProperty<long double>("_long double", 333.222);
|
||||
o.SetProperty<bool>("_bool", true);
|
||||
o.SetProperty<vector<bool>>("_vector<bool>", { true, true });
|
||||
o.SetProperty<boost::filesystem::path>("_boost::filesystem::path", boost::filesystem::path("C:\\Windows"));
|
||||
o.SetProperty<vector<char>>("_vector<char>", { 'a', 'b', 'c' });
|
||||
o.SetProperty<vector<signed char>>("_vector<signed char>", { -1, -2, -3 });
|
||||
o.SetProperty<vector<unsigned char>>("_vector<unsigned char>", { 1, 2, 3 });
|
||||
o.SetProperty<vector<string>>("_vector<string>", { "aa", "bb", "cc" });
|
||||
o.SetProperty<vector<int>>("_vector<int>", { 1, 2, 3 });
|
||||
o.SetProperty<vector<size_t>>("_vector<size_t>", { 1, 2, 3 });
|
||||
o.SetProperty<vector<uint32_t>>("_vector<uint32_t>", { 12, 13, 14 });
|
||||
o.SetProperty<vector<uint64_t>>("_vector<uint64_t>", { 123, 124, 125 });
|
||||
o.SetProperty<vector<long>>("_vector<long>", { 1234, 1235, 1236 });
|
||||
o.SetProperty<vector<long long>>("_vector<long long>", { 12345, 12346, 12347 });
|
||||
o.SetProperty<vector<unsigned>>("_vector<unsigned>", { 3, 4, 5 });
|
||||
o.SetProperty<vector<unsigned long>>("_vector<unsigned long>", { 32, 33, 34 });
|
||||
o.SetProperty<vector<unsigned long long>>("_vector<unsigned long long>", { 321, 322, 323 });
|
||||
o.SetProperty<vector<float>>("_vector<float>", { 3.2, 3.3, 3.4 });
|
||||
o.SetProperty<vector<double>>("_vector<double>", { 33.22, 33.23, 33.24 });
|
||||
o.SetProperty<vector<long double>>("_vector<long double>", { 333.222, 333.223, 333.224 });
|
||||
o.SetProperty<vector<boost::filesystem::path>>("_vector<boost::filesystem::path>", { boost::filesystem::path("C:\\Windows"), boost::filesystem::path("C:\\Windows\\System32") });
|
||||
|
||||
ASSERT_EQ(o.GetPropertyAsString("_char"), "a");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_signed char"), "-2");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_unsigned char"), "2");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_const char*"), "testcstring");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_string"), "teststring");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_int"), "1");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_size_t"), "11");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_uint32_t"), "12");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_uint64_t"), "123");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_long"), "1234");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_long long"), "12345");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_unsigned"), "3");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_unsigned long"), "32");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_unsigned long long"), "321");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_float"), "3.2");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_double"), "33.22");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_long double"), "333.222");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_bool"), "true");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<bool>"), "true, true");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_boost::filesystem::path"), "\"C:\\Windows\"");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<char>"), "a, b, c");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<signed char>"), "-1, -2, -3");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<unsigned char>"), "1, 2, 3");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<string>"), "aa, bb, cc");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<int>"), "1, 2, 3");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<size_t>"), "1, 2, 3");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<uint32_t>"), "12, 13, 14");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<uint64_t>"), "123, 124, 125");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<long>"), "1234, 1235, 1236");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<long long>"), "12345, 12346, 12347");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<unsigned>"), "3, 4, 5");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<unsigned long>"), "32, 33, 34");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<unsigned long long>"), "321, 322, 323");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<float>"), "3.2, 3.3, 3.4");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<double>"), "33.22, 33.23, 33.24");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<long double>"), "333.222, 333.223, 333.224");
|
||||
ASSERT_EQ(o.GetPropertyAsString("_vector<boost::filesystem::path>"), "\"C:\\Windows\", \"C:\\Windows\\System32\"");
|
||||
}
|
||||
|
||||
TEST(Properties, EventEmissionAndStringConversion)
|
||||
{
|
||||
fair::mq::ProgOptions o;
|
||||
|
||||
o.Subscribe<char>("test", [](const string& /* key */, char e) { ASSERT_EQ(e, 'a'); });
|
||||
o.Subscribe<signed char>("test", [](const string& /* key */, signed char e) { ASSERT_EQ(e, -2); });
|
||||
o.Subscribe<unsigned char>("test", [](const string& /* key */, unsigned char e) { ASSERT_EQ(e, 2); });
|
||||
o.Subscribe<const char*>("test", [](const string& /* key */, const char* e) { ASSERT_EQ(e, "testcstring"); });
|
||||
o.Subscribe<string>("test", [](const string& /* key */, string e) { ASSERT_EQ(e, "teststring"); });
|
||||
o.Subscribe<int>("test", [](const string& /* key */, int e) { ASSERT_EQ(e, 1); });
|
||||
o.Subscribe<long>("test", [](const string& /* key */, long e) { ASSERT_EQ(e, 1234); });
|
||||
o.Subscribe<long long>("test", [](const string& /* key */, long long e) { ASSERT_EQ(e, 12345); });
|
||||
o.Subscribe<unsigned>("test", [](const string& /* key */, unsigned e) { ASSERT_EQ(e, 3); });
|
||||
o.Subscribe<unsigned long>("test", [](const string& /* key */, unsigned long e) { ASSERT_EQ(e, 32); });
|
||||
o.Subscribe<unsigned long long>("test", [](const string& /* key */, unsigned long long e) { ASSERT_EQ(e, 321); });
|
||||
o.Subscribe<float>("test", [](const string& /* key */, float e) { ASSERT_EQ(e, 3.2f); });
|
||||
o.Subscribe<double>("test", [](const string& /* key */, double e) { ASSERT_EQ(e, 33.22); });
|
||||
o.Subscribe<long double>("test", [](const string& /* key */, long double e) { ASSERT_EQ(e, 333.222); });
|
||||
o.Subscribe<bool>("test", [](const string& /* key */, bool e) { ASSERT_EQ(e, true); });
|
||||
o.Subscribe<boost::filesystem::path>("test", [](const string& /* key */, boost::filesystem::path e) { ASSERT_EQ(e, boost::filesystem::path("C:\\Windows")); });
|
||||
o.Subscribe<vector<bool>>("test", [](const string& /* key */, vector<bool> e) { ASSERT_EQ(e, vector<bool>({ true, true })); });
|
||||
o.Subscribe<vector<char>>("test", [](const string& /* key */, vector<char> e) { ASSERT_EQ(e, vector<char>({ 'a', 'b', 'c' })); });
|
||||
o.Subscribe<vector<signed char>>("test", [](const string& /* key */, vector<signed char> e) { ASSERT_EQ(e, vector<signed char>({ -1, -2, -3 })); });
|
||||
o.Subscribe<vector<unsigned char>>("test", [](const string& /* key */, vector<unsigned char> e) { ASSERT_EQ(e, vector<unsigned char>({ 1, 2, 3 })); });
|
||||
o.Subscribe<vector<string>>("test", [](const string& /* key */, vector<string> e) { ASSERT_EQ(e, vector<string>({ "aa", "bb", "cc" })); });
|
||||
o.Subscribe<vector<int>>("test", [](const string& /* key */, vector<int> e) { ASSERT_EQ(e, vector<int>({ 1, 2, 3 })); });
|
||||
o.Subscribe<vector<long>>("test", [](const string& /* key */, vector<long> e) { ASSERT_EQ(e, vector<long>({ 1234, 1235, 1236 })); });
|
||||
o.Subscribe<vector<long long>>("test", [](const string& /* key */, vector<long long> e) { ASSERT_EQ(e, vector<long long>({ 12345, 12346, 12347 })); });
|
||||
o.Subscribe<vector<unsigned>>("test", [](const string& /* key */, vector<unsigned> e) { ASSERT_EQ(e, vector<unsigned>({ 3, 4, 5 })); });
|
||||
o.Subscribe<vector<unsigned long>>("test", [](const string& /* key */, vector<unsigned long> e) { ASSERT_EQ(e, vector<unsigned long>({ 32, 33, 34 })); });
|
||||
o.Subscribe<vector<unsigned long long>>("test", [](const string& /* key */, vector<unsigned long long> e) { ASSERT_EQ(e, vector<unsigned long long>({ 321, 322, 323 })); });
|
||||
o.Subscribe<vector<float>>("test", [](const string& /* key */, vector<float> e) { ASSERT_EQ(e, vector<float>({ 3.2, 3.3, 3.4 })); });
|
||||
o.Subscribe<vector<double>>("test", [](const string& /* key */, vector<double> e) { ASSERT_EQ(e, vector<double>({ 33.22, 33.23, 33.24 })); });
|
||||
o.Subscribe<vector<long double>>("test", [](const string& /* key */, vector<long double> e) { ASSERT_EQ(e, vector<long double>({ 333.222, 333.223, 333.224 })); });
|
||||
o.Subscribe<vector<boost::filesystem::path>>("test", [](const string& /* key */, vector<boost::filesystem::path> e) { ASSERT_EQ(e, vector<boost::filesystem::path>({ boost::filesystem::path("C:\\Windows"), boost::filesystem::path("C:\\Windows\\System32") })); });
|
||||
|
||||
o.SetProperty<char>("_char", 'a');
|
||||
o.SetProperty<signed char>("_signed char", -2);
|
||||
o.SetProperty<unsigned char>("_unsigned char", 2);
|
||||
o.SetProperty<const char*>("_const char*", "testcstring");
|
||||
o.SetProperty<string>("_string", "teststring");
|
||||
o.SetProperty<int>("_int", 1);
|
||||
o.SetProperty<long>("_long", 1234);
|
||||
o.SetProperty<long long>("_long long", 12345);
|
||||
o.SetProperty<unsigned>("_unsigned", 3);
|
||||
o.SetProperty<unsigned long>("_unsigned long", 32);
|
||||
o.SetProperty<unsigned long long>("_unsigned long long", 321);
|
||||
o.SetProperty<float>("_float", 3.2);
|
||||
o.SetProperty<double>("_double", 33.22);
|
||||
o.SetProperty<long double>("_long double", 333.222);
|
||||
o.SetProperty<bool>("_bool", true);
|
||||
o.SetProperty<vector<bool>>("_vector<bool>", { true, true });
|
||||
o.SetProperty<boost::filesystem::path>("_boost::filesystem::path", boost::filesystem::path("C:\\Windows"));
|
||||
o.SetProperty<vector<char>>("_vector<char>", { 'a', 'b', 'c' });
|
||||
o.SetProperty<vector<signed char>>("_vector<signed char>", { -1, -2, -3 });
|
||||
o.SetProperty<vector<unsigned char>>("_vector<unsigned char>", { 1, 2, 3 });
|
||||
o.SetProperty<vector<string>>("_vector<string>", { "aa", "bb", "cc" });
|
||||
o.SetProperty<vector<int>>("_vector<int>", { 1, 2, 3 });
|
||||
o.SetProperty<vector<long>>("_vector<long>", { 1234, 1235, 1236 });
|
||||
o.SetProperty<vector<long long>>("_vector<long long>", { 12345, 12346, 12347 });
|
||||
o.SetProperty<vector<unsigned>>("_vector<unsigned>", { 3, 4, 5 });
|
||||
o.SetProperty<vector<unsigned long>>("_vector<unsigned long>", { 32, 33, 34 });
|
||||
o.SetProperty<vector<unsigned long long>>("_vector<unsigned long long>", { 321, 322, 323 });
|
||||
o.SetProperty<vector<float>>("_vector<float>", { 3.2, 3.3, 3.4 });
|
||||
o.SetProperty<vector<double>>("_vector<double>", { 33.22, 33.23, 33.24 });
|
||||
o.SetProperty<vector<long double>>("_vector<long double>", { 333.222, 333.223, 333.224 });
|
||||
o.SetProperty<vector<boost::filesystem::path>>("_vector<boost::filesystem::path>", { boost::filesystem::path("C:\\Windows"), boost::filesystem::path("C:\\Windows\\System32") });
|
||||
}
|
||||
|
||||
} // namespace
|
Loading…
Reference in New Issue
Block a user