Changeset 8591


Ignore:
Timestamp:
Mar 21, 2016 3:44:15 PM (4 years ago)
Author:
vjohnsson
Message:

#4866: Error reporting for checking derivative attribute of Real tag removed.

Location:
FMILibrary/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • FMILibrary/trunk/Config.cmake/test_fmi2.cmake

    r8574 r8591  
    8080set(PASS_NAME_CHECK 1)
    8181
     82set(EXPECT_ERROR 1)
    8283add_test(ctest_fmi2_check_variable_naming_conventions_test fmi2_check_variable_naming_conventions_test ${RTTESTDIR}/FMI2/naming_conventions_xmls/)
    83 ADD_TEST(ctest_fmi2_import_xml_test_empty fmi2_import_xml_test ${FMU2_DUMMY_FOLDER})
     84ADD_TEST(ctest_fmi2_import_xml_test_empty fmi2_import_xml_test ${FMU2_DUMMY_FOLDER} ${EXPECT_ERROR})
    8485add_test(ctest_fmi2_import_xml_test_me fmi2_import_xml_test ${TEST_OUTPUT_FOLDER}/${FMU2_DUMMY_ME_MODEL_IDENTIFIER}_me)
    8586add_test(ctest_fmi2_import_xml_test_cs fmi2_import_xml_test ${TEST_OUTPUT_FOLDER}/${FMU2_DUMMY_CS_MODEL_IDENTIFIER}_cs)
  • FMILibrary/trunk/Test/FMI2/fmi2_import_xml_test.cc

    r5638 r8591  
    2626#include <FMI2/fmi2_import.h>
    2727
    28 
    29 void mylogger(jm_callbacks* c, jm_string module, jm_log_level_enu_t log_level, jm_string message)
    30 {
    31         printf("module = %s, log level = %d: %s\n", module, log_level, message);
    32 }
     28int expect_error;
    3329
    3430int annotation_start_handle(void *context, const char *parentName, void *parent, const char *elm, const char **attr) {
     
    6864/*  getchar(); */
    6965    exit(code);
     66}
     67
     68void mylogger(jm_callbacks* c, jm_string module, jm_log_level_enu_t log_level, jm_string message)
     69{
     70    printf("[%s][%s] %s\n", module, jm_log_level_to_string(log_level), message);
     71    if (!expect_error && log_level == jm_log_level_error) {
     72        do_exit(1);
     73    }
    7074}
    7175
     
    324328
    325329    tmpPath = argv[1];
     330    expect_error = argc > 2;
    326331
    327332    callbacks.malloc = malloc;
     
    351356        do_exit(1);
    352357    }
    353 
    354358
    355359    printf("Model name: %s\n", fmi2_import_get_model_name(fmu));
  • FMILibrary/trunk/Test/FMI2/fmu_dummy/modelDescription_cs.xml

    r5576 r8591  
    4141    <ScalarVariable name="LOGGER_TEST_BOOLEAN" valueReference="0" description="This is only used to test logger replace function #b0#">
    4242     <Boolean/>
    43   </ScalarVariable> 
     43  </ScalarVariable>
     44  <ScalarVariable name="LOGGER_TEST_DERIVATIVE" valueReference="10" description="This is to test that the derivative attribute may appear on any Real variables.">
     45     <Real/>
     46  </ScalarVariable>
     47  <ScalarVariable name="LOGGER_TEST_DERIVATIVE_DER" valueReference="11" variability="fixed" description="This is to test that the derivative attribute may appear on any Real variables.">
     48     <Real derivative="12"/>
     49  </ScalarVariable>
    4450</ModelVariables>
    4551<ModelStructure>
  • FMILibrary/trunk/src/XML/src/FMI2/fmi2_xml_variable.c

    r8464 r8591  
    568568            variable->reinit = (char)reinit;
    569569
    570             if (variable->variability != fmi2_variability_enu_continuous) {
    571                 /* If derivative is set, this variable must be continuous. */
    572                 if (derivativeOf) {
    573                     fmi2_xml_parse_error(context, "The derivative attribute may only appear on continuous-time Real variables.");
    574                     /* return -1; */
    575                 }
    576                 if (reinit) {
    577                     fmi2_xml_parse_error(context, "The reinit attribute may only be set on continuous-time states.");
    578                     return -1;
    579                 }
     570            if (variable->variability != fmi2_variability_enu_continuous && reinit) {
    580571                /* If reinit is true, this variable must be continuous. */
     572                fmi2_xml_parse_error(context, "The reinit attribute may only be set on continuous-time states.");
     573                return -1;
    581574            }
    582575        }
Note: See TracChangeset for help on using the changeset viewer.