1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- #include "ua_server.h"
- #include "ua_config_default.h"
- #include "ua_types.h"
- #include "tests/ua_namespace_di.h"
- #include "tests/ua_namespace_plc.h"
- #include "check.h"
- #include "testing_clock.h"
- #include "unistd.h"
- UA_Server *server = NULL;
- UA_ServerConfig *config = NULL;
- static void setup(void) {
- config = UA_ServerConfig_new_default();
- server = UA_Server_new(config);
- UA_Server_run_startup(server);
- }
- static void teardown(void) {
- UA_Server_run_shutdown(server);
- UA_Server_delete(server);
- UA_ServerConfig_delete(config);
- }
- START_TEST(Server_addDiNodeset) {
- UA_StatusCode retval = ua_namespace_di(server);
- ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
- }
- END_TEST
- START_TEST(Server_addPlcNodeset) {
- UA_StatusCode retval = ua_namespace_plc(server);
- ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
- }
- END_TEST
- static Suite* testSuite_Client(void) {
- Suite *s = suite_create("Server Nodeset Compiler");
- TCase *tc_server = tcase_create("Server DI and PLCopen nodeset");
- tcase_add_unchecked_fixture(tc_server, setup, teardown);
- tcase_add_test(tc_server, Server_addDiNodeset);
- tcase_add_test(tc_server, Server_addPlcNodeset);
- suite_add_tcase(s, tc_server);
- return s;
- }
- int main(void) {
- Suite *s = testSuite_Client();
- SRunner *sr = srunner_create(s);
- srunner_set_fork_status(sr, CK_NOFORK);
- srunner_run_all(sr,CK_NORMAL);
- int number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
- }
|