Skip to content

Commit

Permalink
Add test for re-opened #3424
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Sep 7, 2015
1 parent 1588408 commit d2b11e6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions openmodelica/diff/AddDeleteComponent.mos
@@ -0,0 +1,35 @@
// status: correct

echo(false);
s1 := "model M1
annotation(Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}}), graphics={
Line(points={{-60,50},{60,50}}, color={0,0,255}),
Line(points={{-40,30},{40,30}}, color={0,0,255}),
Line(points={{-20,10},{20,10}}, color={0,0,255}),
Line(points={{0,90},{0,50}}, color={0,0,255})}));
end M1;";
loadString(s1, "M1.mo");
getErrorString();
addComponent(m1, Real, M1, annotate=Placement(visible=true, transformation=transformation(origin={-24,-54}, extent={{-10,-10},{10,10}}, rotation=0)));
getErrorString();
s2 := listFile(M1);
getErrorString();
contents := diffModelicaFileListings(s1, s2, OpenModelica.Scripting.DiffFormat.plain);
getErrorString();
deleteComponent(m1, M1);
getErrorString();
s2 := listFile(M1);
if s1<>diffModelicaFileListings(contents, s2, OpenModelica.Scripting.DiffFormat.plain) then
print("\nFailed \n");
print("\nStart model:\n\n" + contents + "\n");
print("\ndeleteComponent+listFile:\n\n" + s2 + "\n");
print("\nDiff:\n\n" + diffModelicaFileListings(contents, s2) + "\n");
print(getErrorString());
end if;
print("OK\n");

// Result:
// OK
// endResult
1 change: 1 addition & 0 deletions openmodelica/diff/Makefile
Expand Up @@ -4,6 +4,7 @@ TEST = ../../rtest
TESTFILES = \
AddComponent.mos \
AddComponent2.mos \
AddDeleteComponent.mos \
ChangeSourceFile.mos \
ListFile.mos \
TestDiffListAPI.mos
Expand Down

0 comments on commit d2b11e6

Please sign in to comment.