Browse Source

tests for readValue with severeal attributes implemented

ChristianFimmers 9 years ago
parent
commit
9585f91c13
3 changed files with 16 additions and 2 deletions
  1. 6 1
      src/server/ua_services.h
  2. 6 1
      src/server/ua_services_attribute.c
  3. 4 0
      tests/CMakeLists.txt

+ 6 - 1
src/server/ua_services.h

@@ -196,8 +196,13 @@ void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_Un
  */
 void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *request,
                   UA_ReadResponse *response);
-// Service_HistoryRead
+#define TEST
+#ifdef TEST
+void readValue(UA_Server *server, UA_TimestampsToReturn timestamps,
+                      const UA_ReadValueId *id, UA_DataValue *v);
+#endif /*DEBUG */
 
+// Service_HistoryRead
 /**
  * Used to write one or more Attributes of one or more Nodes. For constructed
  * Attribute values whose elements are indexed, such as an array, this Service

+ 6 - 1
src/server/ua_services_attribute.c

@@ -92,7 +92,12 @@ static void handleSourceTimestamps(UA_TimestampsToReturn timestamps, UA_DataValu
 }
 
 /** Reads a single attribute from a node in the nodestore. */
-static void readValue(UA_Server *server, UA_TimestampsToReturn timestamps,
+#define DEBUG
+#ifdef DEBUG
+#else
+static
+#endif
+void readValue(UA_Server *server, UA_TimestampsToReturn timestamps,
                       const UA_ReadValueId *id, UA_DataValue *v) {
     UA_String binEncoding = UA_STRING("DefaultBinary");
     UA_String xmlEncoding = UA_STRING("DefaultXml");

+ 4 - 0
tests/CMakeLists.txt

@@ -39,6 +39,10 @@ add_executable(check_services_view check_services_view.c $<TARGET_OBJECTS:open62
 target_link_libraries(check_services_view ${LIBS})
 add_test(services_view ${CMAKE_CURRENT_BINARY_DIR}/check_services_view)
 
+add_executable(check_services_attributes check_services_attributes.c $<TARGET_OBJECTS:open62541-object>)
+target_link_libraries(check_services_attributes ${LIBS})
+add_test(services_attributes ${CMAKE_CURRENT_BINARY_DIR}/check_services_attributes)
+
 add_executable(check_nodestore check_nodestore.c $<TARGET_OBJECTS:open62541-object>)
 target_link_libraries(check_nodestore ${LIBS})
 add_test(nodestore ${CMAKE_CURRENT_BINARY_DIR}/check_nodestore)