check_services_view.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. ============================================================================
  3. Name : check_stack.c
  4. Author :
  5. Version :
  6. Copyright : Your copyright notice
  7. Description :
  8. ============================================================================
  9. */
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include "opcua.h"
  13. #include "ua_services.h"
  14. #include "ua_statuscodes.h"
  15. #include "check.h"
  16. START_TEST(Service_TranslateBrowsePathsToNodeIds_SmokeTest)
  17. {
  18. UA_TranslateBrowsePathsToNodeIdsRequest* request;
  19. UA_TranslateBrowsePathsToNodeIdsRequest_new(&request);
  20. UA_TranslateBrowsePathsToNodeIdsResponse* response;
  21. UA_TranslateBrowsePathsToNodeIdsResponse_new(&response);
  22. request->browsePathsSize = 1;
  23. UA_Array_new((void***)&(request->browsePaths),request->browsePathsSize,UA_BROWSEPATH);
  24. Service_TranslateBrowsePathsToNodeIds(UA_NULL,request,response);
  25. ck_assert_int_eq(response->resultsSize,request->browsePathsSize);
  26. ck_assert_int_eq(response->results[0]->statusCode,UA_STATUSCODE_BADQUERYTOOCOMPLEX);
  27. }
  28. END_TEST
  29. Suite* testSuite_Service_TranslateBrowsePathsToNodeIds()
  30. {
  31. Suite *s = suite_create("Service_TranslateBrowsePathsToNodeIds");
  32. TCase *tc_core = tcase_create("Core");
  33. tcase_add_test(tc_core, Service_TranslateBrowsePathsToNodeIds_SmokeTest);
  34. suite_add_tcase(s,tc_core);
  35. return s;
  36. }
  37. int main (void)
  38. {
  39. int number_failed = 0;
  40. Suite *s;
  41. SRunner *sr;
  42. s = testSuite_Service_TranslateBrowsePathsToNodeIds();
  43. sr = srunner_create(s);
  44. srunner_run_all(sr,CK_NORMAL);
  45. number_failed += srunner_ntests_failed(sr);
  46. srunner_free(sr);
  47. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  48. }