check_server_userspace.c 1.2 KB

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