Skip to content

Commit

Permalink
Add test for RefArray, ticket:4093
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Nov 5, 2016
1 parent aab9128 commit cca794c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions openmodelica/cppruntime/Makefile
Expand Up @@ -14,6 +14,7 @@ externalArrayInputTest.mos \
mathFunctionsTest.mos \
functionPointerTest.mos \
recordTupleReturnTest.mos \
RefArrayDim2.mos \
solveTest.mos \
testMatrixIO.mos

Expand Down
41 changes: 41 additions & 0 deletions openmodelica/cppruntime/RefArrayDim2.mos
@@ -0,0 +1,41 @@
// name: RefArrayDim2
// keywords: multi-dimensional RefArray external F77 LAPACK, ticket:4093
// status: correct
// teardown_command: rm -f *AliasArrayTest*

setCommandLineOptions("+simCodeTarget=Cpp");

loadModel(Modelica);
loadString("
model AliasArrayTest
Real[3,3] A = {{t, 2, 3}, {4, t, 6}, {7, 8, t}}; // RefArrayDim2
Real[:] b = (t + 1) * {1, 2, 3};
Real t = time;
output Real[3] x;
equation
x = Modelica.Math.Matrices.solve(A, b);
annotation(experiment(StopTime = 0));
end AliasArrayTest;
");
getErrorString();

simulate(AliasArrayTest); getErrorString();
val(x[1], 0);
val(x[2], 0);
val(x[3], 0);

// Result:
// true
// true
// true
// ""
// record SimulationResult
// resultFile = "AliasArrayTest_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 0.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'AliasArrayTest', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 0.2
// 0.2
// 0.2
// endResult

0 comments on commit cca794c

Please sign in to comment.