check_server_userspace.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <stdio.h>
  5. #include <stdlib.h>
  6. #include "ua_types.h"
  7. #include "ua_config_standard.h"
  8. #include "check.h"
  9. START_TEST(Server_addNamespace_ShallWork)
  10. {
  11. UA_ServerConfig config = UA_ServerConfig_standard;
  12. UA_Server *server = UA_Server_new(config);
  13. UA_UInt16 a = UA_Server_addNamespace(server, "http://nameOfNamespace");
  14. UA_UInt16 b = UA_Server_addNamespace(server, "http://nameOfNamespace");
  15. UA_UInt16 c = UA_Server_addNamespace(server, "http://nameOfNamespace2");
  16. UA_Server_delete(server);
  17. ck_assert_uint_gt(a, 0);
  18. ck_assert_uint_eq(a,b);
  19. ck_assert_uint_ne(a,c);
  20. }
  21. END_TEST
  22. static Suite* testSuite_ServerUserspace(void) {
  23. Suite *s = suite_create("ServerUserspace");
  24. TCase *tc_core = tcase_create("Core");
  25. tcase_add_test(tc_core, Server_addNamespace_ShallWork);
  26. suite_add_tcase(s,tc_core);
  27. return s;
  28. }
  29. int main(void) {
  30. int number_failed = 0;
  31. Suite *s;
  32. SRunner *sr;
  33. s = testSuite_ServerUserspace();
  34. sr = srunner_create(s);
  35. srunner_run_all(sr,CK_NORMAL);
  36. number_failed += srunner_ntests_failed(sr);
  37. srunner_free(sr);
  38. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  39. }