check_nodeset_compiler_adi.c 1.7 KB

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