-
Notifications
You must be signed in to change notification settings - Fork 298
/
AddClassAnnotation1.mos
46 lines (44 loc) · 1.95 KB
/
AddClassAnnotation1.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// status: correct
// cflags: -d=-newInst
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={{0,90},{0,50}}, color={0,0,255})}),
Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}}), graphics={
Line(points={{-60,50},{60,50}}, color={0,0,255})}));
end M1;";
loadString(s1, "M1.mo");
getErrorString();
addClassAnnotation(M1, annotate=Diagram(coordinateSystem=CoordinateSystem(extent={{-100, -100}, {100, 100}}, preserveAspectRatio=false, initialScale=0.1, grid={2, 2}), graphics={Line(points={{-60,50},{60,50}},color={0,0,255}),Rectangle(origin={-30,-43},extent={{-74,49},{74,-49}})}));
getErrorString();
answer := "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={{0,90},{0,50}}, color={0,0,255})}),
Diagram(coordinateSystem(
preserveAspectRatio=false, extent = {{-100, -100}, {100, 100}, {-100, -100}, {100, 100}}, initialScale = 0.1, grid = {2, 2}), graphics={
Line(points={{-60,50},{60,50}}, color={0,0,255}), Line(points = {{-60, 50}, {60, 50}}, color = {0, 0, 255}), Rectangle(origin = {-30, -43}, extent = {{-74, 49}, {74, -49}})}));
end M1;";
s2 := listFile(M1);
s3 := diffModelicaFileListings(s1, s2, OpenModelica.Scripting.DiffFormat.plain);
if answer<>s3 then
print("\nFailed \n");
print("\nStart model:\n\n" + s1 + "\n");
print("\nAdded rectangle+listFile:\n\n" + s2 + "\n");
print("\nDiff:\n\n" + diffModelicaFileListings(s1, s2) + "\n");
print("\nPlain diff:\n\n" + s3 + "\n");
print("\nXML Diff:\n\n" + diffModelicaFileListings(s1, s2, OpenModelica.Scripting.DiffFormat.xml) + "\n");
print(getErrorString());
exit(1);
end if;
print("OK\n");
// Result:
// OK
// endResult