check_nodeset_compiler_plc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "ua_server.h"
  5. #include "ua_config_default.h"
  6. #include "ua_types.h"
  7. #include "tests/ua_namespace_tests_di.h"
  8. #include "tests/ua_namespace_tests_plc.h"
  9. #include "check.h"
  10. #include "testing_clock.h"
  11. #include "unistd.h"
  12. UA_Server *server = NULL;
  13. UA_ServerConfig *config = NULL;
  14. static void setup(void) {
  15. config = UA_ServerConfig_new_default();
  16. server = UA_Server_new(config);
  17. UA_Server_run_startup(server);
  18. }
  19. static void teardown(void) {
  20. UA_Server_run_shutdown(server);
  21. UA_Server_delete(server);
  22. UA_ServerConfig_delete(config);
  23. }
  24. START_TEST(Server_addDiNodeset) {
  25. UA_StatusCode retval = ua_namespace_tests_di(server);
  26. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  27. }
  28. END_TEST
  29. START_TEST(Server_addPlcNodeset) {
  30. UA_StatusCode retval = ua_namespace_tests_plc(server);
  31. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  32. }
  33. END_TEST
  34. static Suite* testSuite_Client(void) {
  35. Suite *s = suite_create("Server Nodeset Compiler");
  36. TCase *tc_server = tcase_create("Server DI and PLCopen nodeset");
  37. tcase_add_unchecked_fixture(tc_server, setup, teardown);
  38. tcase_add_test(tc_server, Server_addDiNodeset);
  39. tcase_add_test(tc_server, Server_addPlcNodeset);
  40. suite_add_tcase(s, tc_server);
  41. return s;
  42. }
  43. int main(void) {
  44. Suite *s = testSuite_Client();
  45. SRunner *sr = srunner_create(s);
  46. srunner_set_fork_status(sr, CK_NOFORK);
  47. srunner_run_all(sr,CK_NORMAL);
  48. int number_failed = srunner_ntests_failed(sr);
  49. srunner_free(sr);
  50. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  51. }