Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Aug 13, 2015
2 parents d093e95 + d8f3d68 commit 6f5626c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 9 deletions.
Expand Up @@ -943,7 +943,7 @@ readFile("testModel_info.xml");getErrorString();
// <depends name=\"L\" />
// <depends name=\"FoSeedNLSJac0\" />
// <depends name=\"x\" />
// <rhs>2.0 * (-x) * FoSeedNLSJac0 / L</rhs>
// <rhs>2.0 * (-x) * DIVISION(FoSeedNLSJac0, L)</rhs>
// </assign>
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"21\" lineEnd=\"21\" colStart=\"3\" colEnd=\"24\"/>
Expand All @@ -956,7 +956,7 @@ readFile("testModel_info.xml");getErrorString();
// <depends name=\"L\" />
// <depends name=\"y\" />
// <depends name=\"FoSeedNLSJac0\" />
// <rhs>2.0 * (-FoSeedNLSJac0) * y / L</rhs>
// <rhs>2.0 * (-FoSeedNLSJac0) * DIVISION(y, L)</rhs>
// </assign>
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"22\" lineEnd=\"22\" colStart=\"3\" colEnd=\"33\"/>
Expand Down Expand Up @@ -1071,7 +1071,7 @@ readFile("testModel_info.xml");getErrorString();
// <depends name=\"a\" />
// <depends name=\"vSeedNLSJac1\" />
// <depends name=\"b\" />
// <rhs>b * vSeedNLSJac1 / a</rhs>
// <rhs>DIVISION(b * vSeedNLSJac1, a)</rhs>
// </assign>
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"18\" lineEnd=\"18\" colStart=\"3\" colEnd=\"12\"/>
Expand Down
36 changes: 36 additions & 0 deletions openmodelica/diff/ChangeSourceFile.mos
@@ -0,0 +1,36 @@
// status: correct
// Checks that elements that are not classes are part of the listed file
// even if their source file is different

s := "within ;model M1
Real a;
Real b;
Real c;
M m1;
end M1;";
loadString(s, "M1", "UTF-8");
getErrorString();
setSourceFile(M1, "MX");
getErrorString();
diffModelicaFileListings(s, listFile(M1), OpenModelica.Scripting.DiffFormat.plain);
getErrorString();

// Result:
// "within ;model M1
// Real a;
// Real b;
// Real c;
// M m1;
// end M1;"
// true
// ""
// true
// ""
// "model M1
// Real a;
// Real b;
// Real c;
// M m1;
// end M1;"
// ""
// endResult
1 change: 1 addition & 0 deletions openmodelica/diff/Makefile
Expand Up @@ -3,6 +3,7 @@ TEST = ../../rtest

TESTFILES = \
AddComponent.mos \
ChangeSourceFile.mos \
TestDiffListAPI.mos

# test that currently fail. Move up when fixed.
Expand Down
Expand Up @@ -8,7 +8,7 @@

runScript("../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.Compilation;
modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica.Media.Examples.R134a.R134a1);
compareVars :=
{
Expand All @@ -24,10 +24,12 @@ runScript(modelTesting);getErrorString();
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.Compilation
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica.Media.Examples.R134a.R134a1
// {"volume.medium.h","volume.medium.p","fixedMassFlowRate.port.p","ambient.port.m_flow"}
// Compilation succeeded
// Simulation options: startTime = 0.0, stopTime = 1.01, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Media.Examples.R134a.R134a1', options = '', outputFormat = 'mat', variableFilter = 'time|volume.medium.h|volume.medium.p|fixedMassFlowRate.port.p|ambient.port.m_flow', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica.Media.Examples.R134a.R134a1_res.mat
// Files Equal!
// Warning: Alias set with several free start values
// * candidate: volume.port.p(start = 101325.0)
// * candidate: fixedMassFlowRate.port.p(start = 101325.0)
Expand All @@ -48,6 +50,7 @@ runScript(modelTesting);getErrorString();
// * candidate: volume.port.p(nominal = 1000000.0)
// * candidate: volume.medium.p(nominal = 100000.0)
// => select value from volume.medium.p(nominal = 100000.0) for variable: volume.medium.p
//
// "true
// "
// ""
Expand Down
Expand Up @@ -8,7 +8,7 @@

runScript("../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.Compilation;
modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica.Media.Examples.R134a.R134a2);
compareVars :=
{
Expand All @@ -26,10 +26,12 @@ runScript(modelTesting);getErrorString();
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.Compilation
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica.Media.Examples.R134a.R134a2
// {"volume.medium.h","volume.medium.p","volume1.medium.h","volume1.medium.p","fixedMassFlowRate.port.p","ambient.port.m_flow"}
// Compilation succeeded
// Simulation options: startTime = 0.0, stopTime = 1.01, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Media.Examples.R134a.R134a2', options = '', outputFormat = 'mat', variableFilter = 'time|volume.medium.h|volume.medium.p|volume1.medium.h|volume1.medium.p|fixedMassFlowRate.port.p|ambient.port.m_flow', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica.Media.Examples.R134a.R134a2_res.mat
// Files Equal!
// Warning: Alias set with several free start values
// * candidate: volume1.port.p(start = 101325.0)
// * candidate: shortPipe.port_b.p(start = 101325.0)
Expand Down Expand Up @@ -65,6 +67,7 @@ runScript(modelTesting);getErrorString();
// * candidate: volume.port.p(nominal = 1000000.0)
// * candidate: volume.medium.p(nominal = 100000.0)
// => select value from volume.medium.p(nominal = 100000.0) for variable: volume.medium.p
//
// "true
// "
// ""
Expand Down

0 comments on commit 6f5626c

Please sign in to comment.