4 #include "config_test.h" 15 size_t len1 = strlen(s1);
16 size_t len2 = strlen(s2);
18 char *result = (
char *) malloc((len1 + len2 + 1) *
sizeof(
char));
20 exit(CTEST_RETURN_FAIL);
22 memcpy(result, s1, len1);
23 memcpy(result + len1, s2, len2 + 1);
30 printf(
"module = %s, log level = %d: %s\n", module, log_level, message);
36 void test_parser(
char *xml_dir,
int should_not_log_expected_msg,
int configuration)
44 callbacks->
malloc = malloc;
45 callbacks->
calloc = calloc;
47 callbacks->
free = free;
52 if (configuration != 0) {
63 exit(CTEST_RETURN_FAIL);
67 exit(CTEST_RETURN_FAIL);
103 pass_name_check(
"naming_conventions_xmls/standard/vehicle.engine.speed");
106 pass_name_check(
"naming_conventions_xmls/standard/robot.axis.motor234");
130 fail_name_check(
"naming_conventions_xmls/der/dera-no-closing-parenthesis");
163 int main(
int argc,
char *argv[])
168 printf(
"Usage: %s <path to folder naming_conventions_xmls>\n", argv[0]);
169 exit(CTEST_RETURN_FAIL);
jm_calloc_f calloc
Allocate zero initialized memory.
void test_parser(char *xml_dir, int should_not_log_expected_msg, int configuration)
jm_log_level_enu_t
Log levels supported via the logger functions in jm_callbacks.
FMILIB_EXPORT fmi2_import_t * fmi2_import_parse_xml(fmi_import_context_t *context, const char *dirPath, fmi2_xml_callbacks_t *xml_callbacks)
Create fmi2_import_t structure and parse the FMI 2.0 XML file found in the directory dirName...
Debug messages. Only enabled if library is configured with FMILIB_ENABLE_LOG_LEVEL_DEBUG.
jm_log_level_enu_t log_level
Logging level.
int main(int argc, char *argv[])
static char * expected_message
void parser_log_expected_message(char *xml_dir)
static const int SHOULD_LOG_EXPECTED_MSG
Include file to be used in client applications of the FMI Library.
static int did_not_log_expected_msg
jm_malloc_f malloc
Allocate non-initialized memory.
jm_voidp context
Arbitrary context pointer passed to the logger function.
const char * jm_string
A constant string.
void pass_name_check(char *xml_dir)
FMILIB_EXPORT void fmi_import_set_configuration(fmi_import_context_t *c, int conf)
Sets advanced configuration, if zero is passed default configuration is set. Currently only one non d...
The callbacks struct is sent to all the modules in the library.
struct fmi_xml_context_t fmi_import_context_t
FMI version independent library context. Opaque struct returned from fmi_import_allocate_context() ...
void importlogger(jm_callbacks *c, jm_string module, jm_log_level_enu_t log_level, jm_string message)
FMILIB_EXPORT fmi_import_context_t * fmi_import_allocate_context(jm_callbacks *callbacks)
Create fmi_import_context_t structure.
FMILIB_EXPORT void fmi_import_free_context(fmi_import_context_t *c)
Free memory allocated for the library context.
void test_variable_naming_conventions(void)
jm_realloc_f realloc
Re-allocate memory.
#define FMI_IMPORT_NAME_CHECK
If this configuration option is set, the model description will be checked to follow the variable nam...
static char * name_check_test_directory
jm_free_f free
Free-allocated memory.
jm_logger_f logger
Logging callback.
char * concat(char *s1, char *s2)
void fail_name_check(char *xml_dir)
static const int SHOULD_NOT_LOG_EXPECTED_MSG
struct fmi2_import_t fmi2_import_t
FMU version 2.0 object.