check_nodeset_compiler_plc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <open62541/server.h>
  5. #include <open62541/server_config_default.h>
  6. #include <open62541/types.h>
  7. #include "check.h"
  8. #include "testing_clock.h"
  9. #include "tests/namespace_tests_di_generated.h"
  10. #include "tests/namespace_tests_plc_generated.h"
  11. #include "unistd.h"
  12. UA_Server *server = NULL;
  13. static void setup(void) {
  14. server = UA_Server_new();
  15. UA_ServerConfig_setDefault(UA_Server_getConfig(server));
  16. UA_Server_run_startup(server);
  17. }
  18. static void teardown(void) {
  19. UA_Server_run_shutdown(server);
  20. UA_Server_delete(server);
  21. }
  22. START_TEST(Server_addDiNodeset) {
  23. UA_StatusCode retval = namespace_tests_di_generated(server);
  24. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  25. }
  26. END_TEST
  27. START_TEST(Server_addPlcNodeset) {
  28. UA_StatusCode retval = namespace_tests_plc_generated(server);
  29. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  30. }
  31. END_TEST
  32. static Suite* testSuite_Client(void) {
  33. Suite *s = suite_create("Server Nodeset Compiler");
  34. TCase *tc_server = tcase_create("Server DI and PLCopen nodeset");
  35. tcase_add_unchecked_fixture(tc_server, setup, teardown);
  36. tcase_add_test(tc_server, Server_addDiNodeset);
  37. tcase_add_test(tc_server, Server_addPlcNodeset);
  38. suite_add_tcase(s, tc_server);
  39. return s;
  40. }
  41. int main(void) {
  42. Suite *s = testSuite_Client();
  43. SRunner *sr = srunner_create(s);
  44. srunner_set_fork_status(sr, CK_NOFORK);
  45. srunner_run_all(sr,CK_NORMAL);
  46. int number_failed = srunner_ntests_failed(sr);
  47. srunner_free(sr);
  48. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  49. }