Changeset 13481


Ignore:
Timestamp:
Sep 15, 2019 1:12:24 PM (3 months ago)
Author:
Christian Andersson
Message:

Added a test that verifies that the signature check is working. Related to ticket:5837

Location:
branches/dev-cw-evaluator/Python/src/tests_jmodelica
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-evaluator/Python/src/tests_jmodelica/files/Modelica/ExtFunctionTests.mo

    r13465 r13481  
    3434 Real d = add2(a,b);
    3535end Evaluator_Add;
     36
     37model Evaluator_Multiple_Add
     38 function add
     39     input Real a;
     40     input Real b;
     41     input Real c;
     42     input Real d;
     43     input Real e;
     44     input Real f;
     45     input Real g;
     46     input Real h;
     47     input Real i;
     48     output Real o;
     49
     50     external "C" o=multiple_add(a,b,c,d,e,f,g,h,i) annotation(Library="addNumbersShared",
     51                             Include="#include \"addNumbers.h\"");
     52 end add;
     53 
     54 constant Real a = 1;
     55 constant Real b = 2;
     56 Real c = add(a,b,a,b,a,b,a,b,a);
     57end Evaluator_Multiple_Add;
    3658
    3759model ExtFunctionTest1
  • branches/dev-cw-evaluator/Python/src/tests_jmodelica/files/Modelica/Resources/Include/addNumbers.h

    r13478 r13481  
    1010DllExport double add(double a, double b);
    1111DllExport void add_output(double a, double b, double *c);
     12DllExport double multiple_add(double a, double b, double c, double d, double e, double f, double g, double h, double i);
    1213void multiplyAnArray(int* inputs, int* outputs, int size, int m);
    1314
  • branches/dev-cw-evaluator/Python/src/tests_jmodelica/files/Modelica/Resources/src/addNumbers.c

    r13478 r13481  
    1111}
    1212
     13DllExport double multiple_add(double a, double b, double c, double d, double e, double f, double g, double h, double i)
     14{
     15  return a+b+c+d+e+f+g+h+i;
     16}
     17
    1318void multiplyAnArray(int* inputs, int* outputs, int size, int m)
    1419{
  • branches/dev-cw-evaluator/Python/src/tests_jmodelica/general/test_extfunctions.py

    r13465 r13481  
    7878        assert model.get("d") == 3, model.get("d")
    7979   
     80    @testattr(stddist_base = True)
     81    def test_unsupported_signature(self):
     82        cpath = "ExtFunctionTests.Evaluator_Multiple_Add"
     83        fmu_name = compile_fmu(cpath, self.fpath, compiler_options={"enable_external_evaluator":True}, compiler_log_level="d:log.txt")
     84       
     85        matches = 0
     86        with open("log.txt") as f:
     87            res = fnmatch.filter(f, "*is not supported. Disabling use of the evaluator*")
     88            matches = len(res)
     89       
     90        assert matches == 1, "Does not seem to disabling the evaluator"
     91
     92   
    8093class TestExternalStatic:
    8194
Note: See TracChangeset for help on using the changeset viewer.