check_nodeset_compiler_adi.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 "tests/ua_namespace_tests_di.h"
  7. #include "tests/ua_namespace_tests_adi.h"
  8. #include "check.h"
  9. #include "testing_clock.h"
  10. UA_Server *server = NULL;
  11. UA_ServerConfig *config = NULL;
  12. static void setup(void) {
  13. config = UA_ServerConfig_new_default();
  14. server = UA_Server_new(config);
  15. UA_Server_run_startup(server);
  16. }
  17. static void teardown(void) {
  18. UA_Server_run_shutdown(server);
  19. UA_Server_delete(server);
  20. UA_ServerConfig_delete(config);
  21. }
  22. START_TEST(Server_addDiNodeset) {
  23. UA_StatusCode retval = ua_namespace_tests_di(server);
  24. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  25. }
  26. END_TEST
  27. START_TEST(Server_addAdiNodeset) {
  28. UA_StatusCode retval = ua_namespace_tests_adi(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 ADI 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_addAdiNodeset);
  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. }