-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add null checks for empty value tag(#240)
- Loading branch information
1 parent
4b0b0f3
commit f052d60
Showing
5 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* 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 "check.h" | ||
#include <NodesetLoader/backendOpen62541.h> | ||
#include <NodesetLoader/dataTypes.h> | ||
#include <open62541/server.h> | ||
#include <open62541/server_config_default.h> | ||
#include <open62541/types.h> | ||
|
||
#include "testHelper.h" | ||
|
||
UA_Server *server; | ||
char *nodesetPath = NULL; | ||
|
||
static void setup(void) | ||
{ | ||
printf("path to testnodesets %s\n", nodesetPath); | ||
server = UA_Server_new(); | ||
UA_ServerConfig *config = UA_Server_getConfig(server); | ||
UA_ServerConfig_setDefault(config); | ||
} | ||
|
||
static void teardown(void) | ||
{ | ||
UA_Server_run_shutdown(server); | ||
#ifdef USE_CLEANUP_CUSTOM_DATATYPES | ||
const UA_DataTypeArray *customTypes = | ||
UA_Server_getConfig(server)->customDataTypes; | ||
#endif | ||
UA_Server_delete(server); | ||
#ifdef USE_CLEANUP_CUSTOM_DATATYPES | ||
NodesetLoader_cleanupCustomDataTypes(customTypes); | ||
#endif | ||
} | ||
|
||
START_TEST(loadPrimitiveValues) | ||
{ | ||
ck_assert(NodesetLoader_loadFile(server, nodesetPath, NULL)); | ||
} | ||
END_TEST | ||
|
||
static Suite *testSuite_Client(void) | ||
{ | ||
Suite *s = suite_create("primitiveValues"); | ||
TCase *tc_server = tcase_create("primitiveValues"); | ||
tcase_add_unchecked_fixture(tc_server, setup, teardown); | ||
tcase_add_test(tc_server, loadPrimitiveValues); | ||
suite_add_tcase(s, tc_server); | ||
return s; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
printf("%s", argv[0]); | ||
if (!(argc > 1)) | ||
return 1; | ||
nodesetPath = argv[1]; | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters