mirror of
https://github.com/open62541/open62541.git
synced 2025-06-03 04:00:21 +00:00
fix tests with UA_ENABLE_MULTITHREADING and UA_ENABLE_TYPENAMES disabled
This commit is contained in:
parent
6c8d7eaf0c
commit
5ec8dd51ec
@ -14,7 +14,7 @@ typedef struct {
|
||||
static UA_DataTypeMember Point_members[3] = {
|
||||
/* x */
|
||||
{
|
||||
"x", /* .memberName */
|
||||
UA_TYPENAME("x") /* .memberName */
|
||||
UA_TYPES_FLOAT, /* .memberTypeIndex, points into UA_TYPES since namespaceZero is true */
|
||||
0, /* .padding */
|
||||
true, /* .namespaceZero, see .memberTypeIndex */
|
||||
@ -23,19 +23,19 @@ static UA_DataTypeMember Point_members[3] = {
|
||||
|
||||
/* y */
|
||||
{
|
||||
"y",
|
||||
UA_TYPENAME("y")
|
||||
UA_TYPES_FLOAT, Point_padding_y, true, false
|
||||
},
|
||||
|
||||
/* z */
|
||||
{
|
||||
"y",
|
||||
UA_TYPENAME("z")
|
||||
UA_TYPES_FLOAT, Point_padding_z, true, false
|
||||
}
|
||||
};
|
||||
|
||||
static const UA_DataType PointType = {
|
||||
"Point", /* .typeName */
|
||||
UA_TYPENAME("Point") /* .typeName */
|
||||
{1, UA_NODEIDTYPE_NUMERIC, {4242}}, /* .typeId */
|
||||
sizeof(Point), /* .memSize */
|
||||
0, /* .typeIndex, in the array of custom types */
|
||||
|
@ -1,9 +1,14 @@
|
||||
/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
|
||||
* See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
|
||||
|
||||
#include <signal.h>
|
||||
#include "open62541.h"
|
||||
|
||||
#include <signal.h>
|
||||
static UA_Boolean running = true;
|
||||
static void stopHandler(int sig) {
|
||||
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "received ctrl-c");
|
||||
running = false;
|
||||
}
|
||||
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
static void
|
||||
@ -25,21 +30,14 @@ handler_events(const UA_UInt32 monId, const size_t nEventFields, const UA_Varian
|
||||
}
|
||||
}
|
||||
|
||||
static UA_Boolean running = true;
|
||||
static void stopHandler(int sig) {
|
||||
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "received ctrl-c");
|
||||
running = false;
|
||||
}
|
||||
|
||||
const size_t nSelectClauses = 2;
|
||||
|
||||
static UA_SimpleAttributeOperand *
|
||||
setupSelectClauses(void)
|
||||
{
|
||||
UA_SimpleAttributeOperand *selectClauses = (UA_SimpleAttributeOperand *)UA_Array_new(nSelectClauses, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND]);
|
||||
if(!selectClauses){
|
||||
setupSelectClauses(void) {
|
||||
UA_SimpleAttributeOperand *selectClauses = (UA_SimpleAttributeOperand*)
|
||||
UA_Array_new(nSelectClauses, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND]);
|
||||
if(!selectClauses)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(size_t i =0; i<nSelectClauses; ++i) {
|
||||
UA_SimpleAttributeOperand_init(&selectClauses[i]);
|
||||
|
@ -275,9 +275,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Static Assert
|
||||
* ^^^^^^^^^^^^^
|
||||
* Outputs an error message at compile time if the assert fails.
|
||||
* Utility Definitions
|
||||
* ^^^^^^^^^^^^^^^^^^^ */
|
||||
/* Outputs an error message at compile time if the assert fails.
|
||||
* Example usage:
|
||||
* UA_STATIC_ASSERT(sizeof(long)==7, use_another_compiler_luke)
|
||||
* See: https://stackoverflow.com/a/4815532/869402 */
|
||||
@ -293,8 +293,15 @@ extern "C" {
|
||||
int UA_CTASTR(static_assertion_failed_,msg) : !!(cond); \
|
||||
} UA_CTASTR(static_assertion_failed_,__COUNTER__)
|
||||
#else /* Everybody else */
|
||||
# define UA_STATIC_ASSERT(cond,msg) \
|
||||
typedef char static_assertion_##msg[(cond)?1:-1]
|
||||
# define UA_STATIC_ASSERT(cond,msg) typedef char static_assertion_##msg[(cond)?1:-1]
|
||||
#endif
|
||||
|
||||
/* To generate smaller binaries, descriptive strings can be excluded from the
|
||||
* datatype description */
|
||||
#ifdef UA_ENABLE_TYPENAMES
|
||||
# define UA_TYPENAME(name) name,
|
||||
#else
|
||||
# define UA_TYPENAME(name)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -121,13 +121,6 @@ size_t UA_readNumber(u8 *buf, size_t buflen, u32 *number);
|
||||
#define MIN(A,B) (A > B ? B : A)
|
||||
#define MAX(A,B) (A > B ? A : B)
|
||||
|
||||
/* The typename string can be disabled to safe memory */
|
||||
#ifdef UA_ENABLE_TYPENAMES
|
||||
# define UA_TYPENAME(name) name,
|
||||
#else
|
||||
# define UA_TYPENAME(name)
|
||||
#endif
|
||||
|
||||
#ifdef UA_DEBUG_DUMP_PKGS
|
||||
void UA_EXPORT UA_dump_hex_pkg(UA_Byte* buffer, size_t bufferLen);
|
||||
#endif
|
||||
|
@ -46,6 +46,8 @@ static void teardown(void) {
|
||||
UA_ServerConfig_delete(config);
|
||||
}
|
||||
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
|
||||
UA_Boolean notificationReceived;
|
||||
|
||||
static void monitoredItemHandler(UA_UInt32 monId, UA_DataValue *value, void *context) {
|
||||
@ -137,15 +139,23 @@ START_TEST(Client_methodcall) {
|
||||
}
|
||||
END_TEST
|
||||
|
||||
#endif /* UA_ENABLE_SUBSCRIPTIONS */
|
||||
|
||||
static Suite* testSuite_Client(void) {
|
||||
Suite *s = suite_create("Client Subscription");
|
||||
TCase *tc_client = tcase_create("Client Subscription Basic");
|
||||
tcase_add_checked_fixture(tc_client, setup, teardown);
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
tcase_add_test(tc_client, Client_subscription);
|
||||
suite_add_tcase(s,tc_client);
|
||||
#endif /* UA_ENABLE_SUBSCRIPTIONS */
|
||||
|
||||
TCase *tc_client2 = tcase_create("Client Subscription + Method Call of GetMonitoredItmes");
|
||||
tcase_add_checked_fixture(tc_client2, setup, teardown);
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
tcase_add_test(tc_client2, Client_methodcall);
|
||||
#endif /* UA_ENABLE_SUBSCRIPTIONS */
|
||||
|
||||
Suite *s = suite_create("Client Subscription");
|
||||
suite_add_tcase(s,tc_client);
|
||||
suite_add_tcase(s,tc_client2);
|
||||
return s;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ static void teardown(void) {
|
||||
UA_ServerConfig_delete(config);
|
||||
}
|
||||
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
|
||||
UA_UInt32 subscriptionId;
|
||||
UA_UInt32 monitoredItemId;
|
||||
|
||||
@ -301,11 +303,13 @@ START_TEST(Server_deleteMonitoredItems) {
|
||||
}
|
||||
END_TEST
|
||||
|
||||
#endif /* UA_ENABLE_SUBSCRIPTIONS */
|
||||
|
||||
static Suite* testSuite_Client(void) {
|
||||
Suite *s = suite_create("Server Subscription");
|
||||
TCase *tc_server = tcase_create("Server Subscription Basic");
|
||||
tcase_add_checked_fixture(tc_server, setup, teardown);
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
tcase_add_test(tc_server, Server_createSubscription);
|
||||
tcase_add_test(tc_server, Server_modifySubscription);
|
||||
tcase_add_test(tc_server, Server_setPublishingMode);
|
||||
@ -317,6 +321,7 @@ static Suite* testSuite_Client(void) {
|
||||
tcase_add_test(tc_server, Server_deleteSubscription);
|
||||
tcase_add_test(tc_server, Server_republish_invalid);
|
||||
tcase_add_test(tc_server, Server_publishCallback);
|
||||
#endif /* UA_ENABLE_SUBSCRIPTIONS */
|
||||
suite_add_tcase(s, tc_server);
|
||||
|
||||
return s;
|
||||
|
@ -135,7 +135,6 @@ END_TEST
|
||||
|
||||
START_TEST(StatusCode_msg) {
|
||||
#ifndef UA_ENABLE_STATUSCODE_DESCRIPTIONS
|
||||
ck_assert_str_eq(UA_StatusCode_msg(UA_STATUSCODE_GOOD), "StatusCode descriptions not available");
|
||||
return;
|
||||
#endif
|
||||
// first element in table
|
||||
|
Loading…
Reference in New Issue
Block a user