14 using namespace OpcUa;
50 ASSERT_EQ(
id.GetStringIdentifier(),
"StrId");
92 TEST(
Node, EqualIfDifferentTypeButEqualIdentifier)
127 const std::vector<char> expectedData =
133 GetChannel().SetData(expectedData);
139 ASSERT_EQ(
id.TwoByteData.Identifier, 0x1);
144 using namespace OpcUa;
146 const std::vector<char> expectedData =
153 GetChannel().SetData(expectedData);
159 ASSERT_EQ(
id.FourByteData.NamespaceIndex, 0x1);
160 ASSERT_EQ(
id.FourByteData.Identifier, 0x2);
165 using namespace OpcUa;
167 const std::vector<char> expectedData =
174 GetChannel().SetData(expectedData);
180 ASSERT_EQ(
id.NumericData.NamespaceIndex, 0x1);
181 ASSERT_EQ(
id.NumericData.Identifier, 0x2);
186 using namespace OpcUa;
188 const std::vector<char> expectedData =
196 GetChannel().SetData(expectedData);
202 ASSERT_EQ(
id.StringData.NamespaceIndex, 0x1);
203 ASSERT_EQ(
id.StringData.Identifier,
"id");
208 using namespace OpcUa;
210 const std::vector<char> expectedData =
218 GetChannel().SetData(expectedData);
224 ASSERT_EQ(
id.BinaryData.NamespaceIndex, 0x1);
225 std::vector<uint8_t> expectedBytes = {1, 2, 3, 4};
226 ASSERT_EQ(
id.BinaryData.Identifier, expectedBytes);
231 using namespace OpcUa;
233 const std::vector<char> expectedData =
240 1, 2, 3, 4, 5, 6, 7, 8
243 GetChannel().SetData(expectedData);
249 ASSERT_EQ(
id.GuidData.NamespaceIndex, 0x1);
250 ASSERT_EQ(
id.GuidData.Identifier.Data1, 0x01020304);
251 ASSERT_EQ(
id.GuidData.Identifier.Data2, 0x0506);
252 ASSERT_EQ(
id.GuidData.Identifier.Data3, 0x0708);
253 ASSERT_EQ(
id.GuidData.Identifier.Data4[0], 0x01);
254 ASSERT_EQ(
id.GuidData.Identifier.Data4[1], 0x02);
255 ASSERT_EQ(
id.GuidData.Identifier.Data4[2], 0x03);
256 ASSERT_EQ(
id.GuidData.Identifier.Data4[3], 0x04);
257 ASSERT_EQ(
id.GuidData.Identifier.Data4[4], 0x05);
258 ASSERT_EQ(
id.GuidData.Identifier.Data4[5], 0x06);
259 ASSERT_EQ(
id.GuidData.Identifier.Data4[6], 0x07);
260 ASSERT_EQ(
id.GuidData.Identifier.Data4[7], 0x08);
265 using namespace OpcUa;
267 const std::vector<char> expectedData =
277 GetChannel().SetData(expectedData);
283 ASSERT_EQ(
id.StringData.NamespaceIndex, 0x1);
284 ASSERT_EQ(
id.StringData.Identifier,
"id");
290 using namespace OpcUa;
292 const std::vector<char> expectedData =
301 GetChannel().SetData(expectedData);
307 ASSERT_EQ(
id.StringData.NamespaceIndex, 0x1);
308 ASSERT_EQ(
id.StringData.Identifier,
"id");
314 using namespace OpcUa;
316 const std::vector<char> expectedData =
327 GetChannel().SetData(expectedData);
333 ASSERT_EQ(
id.StringData.NamespaceIndex, 0x1);
334 ASSERT_EQ(
id.StringData.Identifier,
"id");
345 using namespace OpcUa;
349 id.TwoByteData.Identifier = 0x1;
351 const std::vector<char> expectedData =
357 GetStream() <<
id <<
flush;
359 ASSERT_EQ(expectedData, GetChannel().SerializedData);
365 using namespace OpcUa;
369 id.FourByteData.NamespaceIndex = 0x1;
370 id.FourByteData.Identifier = 0x2;
372 const std::vector<char> expectedData =
379 GetStream() <<
id <<
flush;
381 ASSERT_EQ(expectedData, GetChannel().SerializedData);
387 using namespace OpcUa;
391 id.NumericData.NamespaceIndex = 0x1;
392 id.NumericData.Identifier = 0x2;
394 const std::vector<char> expectedData =
401 GetStream() <<
id <<
flush;
403 ASSERT_EQ(expectedData, GetChannel().SerializedData);
409 using namespace OpcUa;
413 id.StringData.NamespaceIndex = 0x1;
414 id.StringData.Identifier =
"id";
416 const std::vector<char> expectedData =
424 GetStream() <<
id <<
flush;
426 ASSERT_EQ(expectedData, GetChannel().SerializedData);
432 using namespace OpcUa;
436 id.BinaryData.NamespaceIndex = 0x1;
437 id.BinaryData.Identifier = {1, 2, 3, 4};
439 const std::vector<char> expectedData =
447 GetStream() <<
id <<
flush;
449 ASSERT_EQ(expectedData, GetChannel().SerializedData);
455 using namespace OpcUa;
459 id.GuidData.NamespaceIndex = 0x1;
460 id.GuidData.Identifier.Data1 = 0x01020304;
461 id.GuidData.Identifier.Data2 = 0x0506;
462 id.GuidData.Identifier.Data3 = 0x0708;
463 id.GuidData.Identifier.Data4[0] = 0x01;
464 id.GuidData.Identifier.Data4[1] = 0x02;
465 id.GuidData.Identifier.Data4[2] = 0x03;
466 id.GuidData.Identifier.Data4[3] = 0x04;
467 id.GuidData.Identifier.Data4[4] = 0x05;
468 id.GuidData.Identifier.Data4[5] = 0x06;
469 id.GuidData.Identifier.Data4[6] = 0x07;
470 id.GuidData.Identifier.Data4[7] = 0x08;
472 const std::vector<char> expectedData =
479 1, 2, 3, 4, 5, 6, 7, 8
482 GetStream() <<
id <<
flush;
484 ASSERT_EQ(expectedData, GetChannel().SerializedData);
490 using namespace OpcUa;
494 id.StringData.NamespaceIndex = 0x1;
495 id.StringData.Identifier =
"id";
496 id.NamespaceURI =
"uri";
498 const std::vector<char> expectedData =
508 GetStream() <<
id <<
flush;
510 ASSERT_EQ(expectedData, GetChannel().SerializedData);
516 using namespace OpcUa;
520 id.StringData.NamespaceIndex = 0x1;
521 id.StringData.Identifier =
"id";
524 const std::vector<char> expectedData =
533 GetStream() <<
id <<
flush;
535 ASSERT_EQ(expectedData, GetChannel().SerializedData);
541 using namespace OpcUa;
545 id.StringData.NamespaceIndex = 0x1;
546 id.StringData.Identifier =
"id";
547 id.NamespaceURI =
"uri";
550 const std::vector<char> expectedData =
561 GetStream() <<
id <<
flush;
563 ASSERT_EQ(expectedData, GetChannel().SerializedData);
NodeId TwoByteNodeId(uint8_t value)
TEST_F(TestInfoTest, Names)
#define EXPECT_TRUE(condition)
bool HasNamespaceURI() const
OStream< ChannelType > & flush(OStream< ChannelType > &os)
struct OpcUa::NodeId::TwoByteDataType TwoByteData
#define ASSERT_NE(val1, val2)
void SetNamespaceURI(const std::string &uri)
void SetServerIndex(uint32_t index)
#define EXPECT_FALSE(condition)
NodeId GuidNodeId(Guid value, uint16_t namespaceIndex=0)
TEST(GTestEnvVarTest, Dummy)
struct OpcUa::NodeId::FourByteDataType FourByteData
OPC UA Address space part. GNU LGPL.
#define ASSERT_TRUE(condition)
bool HasServerIndex() const
#define ASSERT_EQ(val1, val2)
A Node object represent an OPC-UA node. It is high level object intended for developper who want to e...
NodeId BinaryNodeId(std::vector< uint8_t > value, uint16_t namespaceIndex=0)
NodeId StringNodeId(std::string value, uint16_t namespaceIndex=0)
NodeId NumericNodeId(uint32_t value, uint16_t namespaceIndex=0)
NodeId FourByteNodeId(uint16_t value, uint8_t namespaceIndex=0)
std::size_t RawSize(const T &obj)