Ticket #3424: AddComponent.mos

File AddComponent.mos, 1.4 KB (added by Adeel Asghar, 9 years ago)
Line 
1echo(false);
2s1 := "model M1
3 annotation(Icon(coordinateSystem(
4 preserveAspectRatio=false,
5 extent={{-100,-100},{100,100}}), graphics={
6 Line(points={{-60,50},{60,50}}, color={0,0,255}),
7 Line(points={{-40,30},{40,30}}, color={0,0,255}),
8 Line(points={{-20,10},{20,10}}, color={0,0,255}),
9 Line(points={{0,90},{0,50}}, color={0,0,255})}));
10end M1;";
11loadString(s1, "M1.mo");
12getErrorString();
13addComponent(m1, Real, M1, annotate=Placement(visible=true, transformation=transformation(origin={-24,-54}, extent={{-10,-10},{10,10}}, rotation=0)));
14getErrorString();
15answer := "model M1
16 Real m1 annotation(Placement(visible = true, transformation(origin = {-32, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
17 annotation(Icon(coordinateSystem(
18 preserveAspectRatio=false,
19 extent={{-100,-100},{100,100}}), graphics={
20 Line(points={{-60,50},{60,50}}, color={0,0,255}),
21 Line(points={{-40,30},{40,30}}, color={0,0,255}),
22 Line(points={{-20,10},{20,10}}, color={0,0,255}),
23 Line(points={{0,90},{0,50}}, color={0,0,255})}));
24end M1;";
25s2 := listFile(M1);
26print(s2);
27if answer<>diffModelicaFileListings(s1, s2, OpenModelica.Scripting.DiffFormat.plain) then
28 print("\nFailed \n");
29 print("\nStart model:\n\n" + s1 + "\n");
30 print("\nAdded component+listFile:\n\n" + s2 + "\n");
31 print("\nDiff:\n\n" + diffModelicaFileListings(s1, s2) + "\n");
32 print(getErrorString());
33end if;