Changeset 13800 for branches/dev5819/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenExternalCevalTests.mo
 Timestamp:
 Oct 22, 2019 11:31:16 AM (7 weeks ago)
 Location:
 branches/dev5819
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/dev5819
 Property svn:mergeinfo changed

branches/dev5819/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenExternalCevalTests.mo
r13600 r13800 17 17 18 18 package CCodeGenExternalCevalTests 19 20 model ExtDynFcn1 21 type E = enumeration(A,B); 22 function f 23 input Real a1; 24 input Integer a2; 25 input Boolean a3; 26 input String a4; 27 input E a5; 28 output Real b1; 29 output Integer b2; 30 output Boolean b3; 31 output String b4; 32 output E b5; 33 external; 34 end f; 35 36 Real x1; 37 Integer x2; 38 Boolean x3; 39 String x4; 40 E x5; 41 equation 42 (x1,x2,x3,x4,x5) = f(1,2,true,"s",E.A); 43 44 annotation(__JModelica(UnitTesting(tests={ 45 FClassMethodTestCase( 46 name="ExtDynFcn1", 47 methodName="externalCTypes", 48 description="Test that the different primitive types generates the correct C mapping", 49 external_constant_evaluation_dynamic=true, 50 methodResult=" 51 f 52 void 53 d,i,i,s,i,*d,*i,*i,*s,*i, 54 ")}))); 55 end ExtDynFcn1; 56 57 model ExtDynFcn2 58 type E = enumeration(A,B); 59 function f 60 input Real[:] a1; 61 input Integer[:] a2; 62 input Boolean[:] a3; 63 input String[:] a4; 64 input E[:] a5; 65 output Real[size(a1,1)] b1; 66 output Integer[size(a2,1)] b2; 67 output Boolean[size(a3,1)] b3; 68 output String[size(a4,1)] b4; 69 output E[size(a5,1)] b5; 70 external; 71 end f; 72 Real[1] x1; 73 Integer[1] x2; 74 Boolean[1] x3; 75 String[1] x4; 76 E[1] x5; 77 equation 78 (x1,x2,x3,x4,x5) = f({1},{2},{true},{"s"},{E.A}); 79 80 annotation(__JModelica(UnitTesting(tests={ 81 FClassMethodTestCase( 82 name="ExtDynFcn2", 83 methodName="externalCTypes", 84 description="Test that the different primitive types (arrays of) generates the correct C mapping", 85 external_constant_evaluation_dynamic=true, 86 methodResult=" 87 f 88 void 89 dv,i,iv,i,iv,i,sv,i,iv,i,*dv,i,*iv,i,*iv,i,*sv,i,*iv,i, 90 ")}))); 91 end ExtDynFcn2; 92 93 model ExtDynFcn3 94 type E = enumeration(A,B); 95 record R 96 Real a1; 97 Integer a2; 98 Boolean a3; 99 String a4; 100 E a5; 101 R2 r2; 102 end R; 103 record R2 104 Real x; 105 end R2; 106 107 function f 108 input R a; 109 output R b; 110 external f(a,b); 111 end f; 112 113 R r = f(R(1,2,true,"s",E.A, R2(3))); 114 115 annotation(__JModelica(UnitTesting(tests={ 116 FClassMethodTestCase( 117 name="ExtDynFcn3", 118 methodName="externalCTypes", 119 description="Test that records generates the correct C mapping", 120 external_constant_evaluation_dynamic=true, 121 methodResult=" 122 f 123 void 124 R[d,i,i,s,i,R[d,],],*R[d,i,i,s,i,R[d,],], 125 ")}))); 126 end ExtDynFcn3; 127 19 128 20 129 model Scalar … … 789 898 end ExtObj5; 790 899 900 model ExtDynObj1 901 function use1 902 input Os.Obj1 o1; 903 output Real x; 904 external annotation(Library="extObjectsUse", Include="#include \"extObjectsUse.h\"", 905 LibraryDirectory="modelica://Library2", IncludeDirectory="Include2"); 906 end use1; 907 908 Os.Obj1 o1 = Os.Obj1(3.13, 3, true, "A message"); 909 Real x = use1(o1); 910 911 annotation(__JModelica(UnitTesting(tests={ 912 FClassMethodTestCase( 913 name="ExtDynObj1", 914 methodName="externalCTypes", 915 description="Verifies that external objects are not handled by the dynamic evaluator", 916 methodResult=" 917 ")}))); 918 end ExtDynObj1; 919 920 791 921 model Dgelsx 792 922 function dgelsx
Note: See TracChangeset
for help on using the changeset viewer.