Просмотр исходного кода

Completely cover UA_Client_Subscriptions_modify

Frank Meerkoetter лет назад: 5
Родитель
Сommit
d42a21a908
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      tests/client/check_client_subscriptions.c

+ 6 - 0
tests/client/check_client_subscriptions.c

@@ -75,6 +75,7 @@ START_TEST(Client_subscription) {
     ck_assert_uint_eq(response.responseHeader.serviceResult, UA_STATUSCODE_GOOD);
     UA_UInt32 subId = response.subscriptionId;
 
+    // a valid UA_Client_Subscriptions_modify
     UA_ModifySubscriptionRequest modifySubscriptionRequest;
     UA_ModifySubscriptionRequest_init(&modifySubscriptionRequest);
     modifySubscriptionRequest.subscriptionId = response.subscriptionId;
@@ -84,6 +85,11 @@ START_TEST(Client_subscription) {
     UA_ModifySubscriptionResponse modifySubscriptionResponse = UA_Client_Subscriptions_modify(client,modifySubscriptionRequest);
     ck_assert_int_eq(modifySubscriptionResponse.responseHeader.serviceResult, UA_STATUSCODE_GOOD);
 
+    // an invalid UA_Client_Subscriptions_modify
+    modifySubscriptionRequest.subscriptionId = 99999; // invalid
+    modifySubscriptionResponse = UA_Client_Subscriptions_modify(client,modifySubscriptionRequest);
+    ck_assert_int_eq(modifySubscriptionResponse.responseHeader.serviceResult, UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID);
+
     /* monitor the server state */
     UA_MonitoredItemCreateRequest monRequest =
         UA_MonitoredItemCreateRequest_default(UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_STATE));