Changeset 13659


Ignore:
Timestamp:
Oct 3, 2019 3:15:11 PM (2 months ago)
Author:
Christian Andersson
Message:

Added more unit tests and disable the option by default. Related to ticket:5837

Location:
branches/dev-cw-evaluator
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-evaluator/CHANGELOG.txt

    r13404 r13659  
    11================= Unreleased ==================
    2 # Change ; Minor ; Compiler; #5830
    3 ParseHandler now have a target for Subscript.
     2# Feature ; Minor ; Compiler; #5837
     3Added a pre-compiled evaluator used for evaluating external functions
     4during the compilation (for performance). Activated by the option
     5"external_constant_evaluation_dynamic"
    46
    57# Change ; Major ; PyFMI ; #5826
  • branches/dev-cw-evaluator/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenExternalCevalTests.mo

    r13647 r13659  
    4646            name="ExtDynFcn1",
    4747            methodName="externalCTypes",
    48             description="Verifies that external objects are not handled by the dynamic evaluator",
     48            description="Test that the different primitive types generates the correct C mapping",
    4949            methodResult="
    5050f
     
    5353")})));
    5454end ExtDynFcn1;
     55
     56model ExtDynFcn2
     57type E = enumeration(A,B);
     58function f
     59    input Real[:] a1;
     60    input Integer[:] a2;
     61    input Boolean[:] a3;
     62    input String[:] a4;
     63    input E[:] a5;
     64    output Real[size(a1,1)] b1;
     65    output Integer[size(a2,1)] b2;
     66    output Boolean[size(a3,1)] b3;
     67    output String[size(a4,1)] b4;
     68    output E[size(a5,1)] b5;
     69    external;
     70end f;
     71    Real[1] x1;
     72    Integer[1] x2;
     73    Boolean[1] x3;
     74    String[1] x4;
     75    E[1] x5;
     76equation
     77    (x1,x2,x3,x4,x5) = f({1},{2},{true},{"s"},{E.A});
     78
     79    annotation(__JModelica(UnitTesting(tests={
     80        FClassMethodTestCase(
     81            name="ExtDynFcn2",
     82            methodName="externalCTypes",
     83            description="Test that the different primitive types (arrays of) generates the correct C mapping",
     84            methodResult="
     85f
     86void
     87dv,i,iv,i,iv,i,sv,i,iv,i,*dv,i,*iv,i,*iv,i,*sv,i,*iv,i,
     88")})));
     89end ExtDynFcn2;
     90
     91model ExtDynFcn3
     92    type E = enumeration(A,B);
     93    record R
     94        Real a1;
     95        Integer a2;
     96        Boolean a3;
     97        String a4;
     98        E a5;
     99        R2 r2;
     100    end R;
     101    record R2
     102        Real x;
     103    end R2;
     104   
     105    function f
     106        input R a;
     107        output R b;
     108        external f(a,b);
     109    end f;
     110   
     111    R r = f(R(1,2,true,"s",E.A, R2(3)));
     112
     113    annotation(__JModelica(UnitTesting(tests={
     114        FClassMethodTestCase(
     115            name="ExtDynFcn3",
     116            methodName="externalCTypes",
     117            description="Test that records generates the correct C mapping",
     118            methodResult="
     119f
     120void
     121R[d,i,i,s,i,R[d,],],*R[d,i,i,s,i,R[d,],],
     122")})));
     123end ExtDynFcn3;
     124
    55125
    56126model Scalar
  • branches/dev-cw-evaluator/Compiler/ModelicaCompiler/module.options

    r13639 r13659  
    138138
    139139********************************************************************************
    140 BOOLEAN external_constant_evaluation_dynamic compiler experimental true
     140BOOLEAN external_constant_evaluation_dynamic compiler experimental false
    141141
    142142"If enabled, calls to external functions will be evaluated during compilation
Note: See TracChangeset for help on using the changeset viewer.