Skip to content

Commit

Permalink
Add test for ticket:4110
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Nov 7, 2016
1 parent 6fb589f commit c985fbe
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
5 changes: 0 additions & 5 deletions openmodelica/diff/LargeFileChange.mos
Expand Up @@ -35,11 +35,6 @@ system("diff -uZ old.mo merged.mo | egrep -v '^(@@|---|[+][+][+])'")
// true
// true
// ""
// within Modelica.Electrical;
// +
// package PowerConverters "Rectifiers, Inverters and DC/DC converters"
// extends Modelica.Icons.Package;
// package UsersGuide "User's Guide"
// each k=1,
// each x0Cos=0,
// each x0Sin=0,
Expand Down
3 changes: 1 addition & 2 deletions openmodelica/diff/Tables.expected.mo
@@ -1,5 +1,4 @@
within Modelica.Blocks;

package Tables
package Internal
function getTable1DValueDer
Expand All @@ -9,4 +8,4 @@ package Tables
external"C" der_y = ModelicaStandardTables_CombiTable1D_getDerValue(tableID, icol, u, der_u);
end getTable1DValueDer;
end Internal;
end Tables;
end Tables;
18 changes: 16 additions & 2 deletions openmodelica/diff/Tables.mos
@@ -1,6 +1,20 @@
// status: correct

readFile("Tables.expected.mo")==diffModelicaFileListings(readFile("Tables.old.mo"),readFile("Tables.new.mo"),OpenModelica.Scripting.DiffFormat.plain);
echo(false);
old := readFile("Tables.old.mo");
new := readFile("Tables.new.mo");
expected := readFile("Tables.expected.mo");
res := diffModelicaFileListings(old,new,OpenModelica.Scripting.DiffFormat.plain);

if expected==res then
print("OK\n");
else
print("Failed; output new file to Tables.wrongexpected.mo\n");
print(diffModelicaFileListings(res,expected,OpenModelica.Scripting.DiffFormat.color)+"\n");
writeFile("Tables.wrongexpected.mo", res);
exit(1);
end if;

// Result:
// true
// OK
// endResult
3 changes: 1 addition & 2 deletions openmodelica/diff/Ticket3619.expected
@@ -1,5 +1,4 @@
within ;

encapsulated package withFolder "Package per EV con modello QuasiStationary"
import Modelica;
import EVQSPkg = withFolder;
Expand Down Expand Up @@ -124,4 +123,4 @@ encapsulated package withFolder "Package per EV con modello QuasiStationary"
fillPattern = FillPattern.Solid), Line(points = {{-90, -90}, {-70, -88}, {-50, -82}, {-30, -72}, {-10, -58}, {10, -40}, {30, -18}, {50, 8}, {70, 38}, {90, 72}, {110, 110}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-82, 90}, {80, 50}}, lineColor = {0, 0, 255}, textString = "%name")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics));
end VhDragForce;
annotation(uses(Modelica(version = "3.2.1")));
end withFolder;
end withFolder;
28 changes: 28 additions & 0 deletions openmodelica/diff/Ticket4110.mos
@@ -0,0 +1,28 @@
// status: correct

echo(false);

a := "model Test
Component component1(x = 5)
annotation();
end Test;";

b := "model Test
Component component1(x = 6) annotation();
end Test;";

echo(true);
diffModelicaFileListings(
a,
b,
OpenModelica.Scripting.DiffFormat.color);
getErrorString();

// Result:
// true
// "model Test
// Component component1(x = 56)
// annotation();
// end Test;"
// ""
// endResult
2 changes: 1 addition & 1 deletion openmodelica/diff/ticket3642.mos
Expand Up @@ -17,9 +17,9 @@ end P;";
loadString(s1, "P.mo");
deleteClass(P.Inner);
answer := "package P

model M
end M;

end P;";
s2 := listFile(P);
res := diffModelicaFileListings(s1, s2, OpenModelica.Scripting.DiffFormat.plain);
Expand Down

0 comments on commit c985fbe

Please sign in to comment.