source: trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/TestModelicaProject.java @ 101

Last change on this file since 101 was 101, checked in by boris, 19 years ago
  • new package org.modelica.mdt.ui.wizards created and current two wizards moved to it
File size: 1.7 KB
Line 
1package org.modelica.mdt.test;
2
3import java.util.List;
4
5import org.eclipse.core.resources.IProject;
6import org.modelica.mdt.core.IModelicaPackage;
7import org.modelica.mdt.core.IModelicaProject;
8import org.modelica.mdt.core.ISystemLibrary;
9import org.modelica.mdt.internal.core.SystemLibrary;
10
11import junit.framework.TestCase;
12
13/**
14 *
15 * @author Andreas Remar
16 *
17 */
18//TODO clean me up !
19// all warnings and System.out.println() must be removed
20public class TestModelicaProject extends TestCase
21{
22   
23    IProject project;
24    IModelicaProject modelicaProject;
25   
26    public void testStuff()
27    {
28        ISystemLibrary isl = new SystemLibrary();
29        List<IModelicaPackage> imps = isl.getPackages();
30        for(IModelicaPackage i : imps)
31        {
32            assertTrue("System library doesn't contain Modelica", 
33                        i.getElementName().equals("Modelica"));
34           
35            System.out.println(i.getElementName());
36           
37            List<IModelicaPackage> imps2 = i.getPackages();
38            String[] names = {"UsersGuide", "Media", "Utilities", "Mechanics", 
39                              "Electrical", "Math",  "Blocks", "Thermal", 
40                              "Icons", "Constants", "SIunits", "StateGraph"};
41            for(int j = 0;j < imps2.size();j++)
42            {
43                assertTrue("Name doesn't match: " + names[j] + " != " + 
44                        imps2.get(j).getElementName(),
45                        names[j].equals(imps2.get(j).getElementName()));
46                System.out.println(" " + imps2.get(j).getElementName());
47            }
48        }
49    }
50   
51    private void traverse(IModelicaPackage imp, int depth)
52    {
53        System.out.println(imp.getElementName());
54
55        if(depth <= 0)
56            return;
57       
58        List<IModelicaPackage> imps = imp.getPackages();
59        for(IModelicaPackage i : imps)
60        {
61            traverse(i, depth-1);
62        }
63    }
64}
Note: See TracBrowser for help on using the repository browser.