14 #include <gtest/gtest.h> 18 using namespace OpcUa;
22 time_t timet03_10_1980 = 321494400;
24 const DateTime dateTime_03_10_1980 = DateTime::FromTimeT(timet03_10_1980, usec);
25 ASSERT_EQ(dateTime_03_10_1980, 138495 * 24 * 3600LL * 10000000LL + 10);
30 const DateTime dateTime_03_10_1980(138495 * 24 * 3600LL * 10000000LL);
31 time_t timet_03_10_1980 = DateTime::ToTimeT(dateTime_03_10_1980);
37 time_t timet =
time(0);
38 const time_t t = DateTime::ToTimeT(DateTime::FromTimeT(timet));
53 ASSERT_EQ(t / 10000000LL * 10000000LL, converted);
66 const DateTime expected(134774LL * 24 * 3600 * 10000000LL);
74 guid.
Data1 = 0x01020304;
87 EXPECT_EQ(converted,
"01020304-0506-0708-090A-0B0C0D0E0F10");
93 guid.
Data1 = 0x01020304;
100 guid.
Data4[4] = 0x0D;
101 guid.
Data4[5] = 0x0E;
102 guid.
Data4[6] = 0x0F;
103 guid.
Data4[7] = 0x10;
146 guid.
Data1 = 0x01020304;
149 guid.
Data4[0] = 0x09;
150 guid.
Data4[1] = 0x0A;
151 guid.
Data4[2] = 0x0B;
152 guid.
Data4[3] = 0x0C;
153 guid.
Data4[4] = 0x0D;
154 guid.
Data4[5] = 0x0E;
155 guid.
Data4[6] = 0x0F;
156 guid.
Data4[7] = 0x10;
160 ASSERT_EQ(strId,
"ns=1;g=01020304-0506-0708-090A-0B0C0D0E0F10;");
166 guid.
Data1 = 0x01020304;
169 guid.
Data4[0] = 0x09;
170 guid.
Data4[1] = 0x0A;
171 guid.
Data4[2] = 0x0B;
172 guid.
Data4[3] = 0x0C;
173 guid.
Data4[4] = 0x0D;
174 guid.
Data4[5] = 0x0E;
175 guid.
Data4[6] = 0x0F;
176 guid.
Data4[7] = 0x10;
189 id.SetNamespaceURI(
"uri");
207 id.SetServerIndex(3);
225 id.SetServerIndex(3);
226 id.SetNamespaceURI(
"uri");
229 ASSERT_EQ(strId,
"srv=3;nsu=uri;ns=2;i=1;");
static DateTime FromTimeT(time_t t, unsigned usec=0)
Guid GetGuidIdentifier() const
static time_t ToTimeT(DateTime dateTime)
#define ASSERT_THROW(statement, expected_exception)
void SetNamespaceURI(const std::string &uri)
void SetServerIndex(uint32_t index)
NodeId GuidNodeId(Guid value, uint16_t namespaceIndex=0)
TEST(GTestEnvVarTest, Dummy)
OPC UA Address space part. GNU LGPL.
Guid ToGuid(const std::string &str)
#define ASSERT_EQ(val1, val2)
NodeId ToNodeId(const std::string &str, uint32_t defaultNamespace=0)
std::string ToString(const AttributeId &value)
static DateTime Current()
NodeId StringNodeId(std::string value, uint16_t namespaceIndex=0)
NodeId NumericNodeId(uint32_t value, uint16_t namespaceIndex=0)
#define EXPECT_EQ(expected, actual)