Skip to content

Commit

Permalink
_ Moved 4 template file tests from testsuite/mytest to ../template an…
Browse files Browse the repository at this point in the history
…d removed testsuite/mytest from testsuite

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13068 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Alachew Mengist committed Sep 27, 2012
1 parent 44fcd09 commit 0ba10f1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Compiler/Template/simulation_failed_template.mos
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// name: <XXX>
// keywords: <insert keywords here>
// status: correct
//
// <insert description here>
//
loadFile("<XXX>.mo");
simulate(<XXX>,numberOfIntervals=2); // 2 intervals == 3 values
getErrorString(); // simulation failed, check error string.
// Result:
// true
// record SimulationResult
// resultFile = "Simulation failed."
// end SimulationResult;
//"#Error, too few equations. Underdetermined system
// The model has 3 variables and 2 equations
// "
// endResult
38 changes: 38 additions & 0 deletions Compiler/Template/simulation_template.mos
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// name: <XXX>
// keywords: <insert keywords here>
// status: correct
//
// <insert description here>
//
loadFile("<XXX>.mo");
simulate(<XXX>,numberOfIntervals=2); // 2 intervals == 3 values
echo(false); // turns of output

res:=readSimulationResult("<XXX>_res.plt",{x,y,z},3);
x:=res[1];
y:=res[2];
z:=res[3];
x:=1000*x;
y:=1000*y;
z:=1000*z;
x:=floor(x);
y:=floor(y);
z:=floor(z);
echo(true); // turns on output
x/1000.0; // rounded value to 3 digits
y/1000.0;
z/1000.0;
readFile("output.log"); // Check that output log is emtpy
system("rm -rf <XXX>.* <XXX>_* output.log"); // remove tmp files.
// Result:
// true
// record SimulationResult
// resultFile = "LinSys_res.plt"
// end SimulationResult;
// true
// {1.0,1.654,2.169,2.62,3.032,3.418}
// {2.0,2.0,2.0,2.0,2.0,2.0}
// {3.0,2.545,2.23,1.979,1.767,1.581}
// ""
// 0
// endResult
11 changes: 11 additions & 0 deletions Compiler/Template/translation_failed_template.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// name: <XXX>
// keywords: <insert keywords here>
// status: incorrect
//
// <insert description here>
//

model <XXX>
Integer x=1.0; // Illegal, translation should fail.
end <XXX>;

17 changes: 17 additions & 0 deletions Compiler/Template/translation_template.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// name: <XXX>
// keywords: <insert keywords here>
// status: correct
//
// <insert description here>
//

model <XXX>
Real x;
end <XXX>;

// insert expected flat file here. Can be done by issuing the command
// ./omc XXX.mo >> XXX.mo and then comment the inserted class.
//
// class <XXX>
// Real x;
// end <XXX>;

0 comments on commit 0ba10f1

Please sign in to comment.