root/ossiedev/branches/mcarrick/DPD/testApp.cpp @ 8704

Revision 8704, 2.4 KB (checked in by mcarrick, 4 years ago)

reducing number of test cases and test code complexity

Line 
1#include "DevicePkg.h"
2
3#include <iostream>
4
5// test function
6void testDevicePkg();
7
8int main()
9{
10        std::cout << std::endl;
11        std::cout << "running test app..." << std::endl;
12
13        testDevicePkg();
14
15        std::cout << std::endl;
16}
17
18void testDevicePkg()
19{
20        std::cout << "testDevicePkg()" << std::endl;
21
22        char *root = "xml/devicePkg.xml";
23        TiXmlDocument xmlDoc(root); // set up path to XML through char string
24
25        if (xmlDoc.LoadFile())
26        {
27                TiXmlHandle doc(&xmlDoc); // get handle to XML file
28                TiXmlElement *devpkg = doc.FirstChild("devicepkg").Element();
29
30                DevicePkg parse(devpkg);
31
32                // print xml tags ...
33                std::cout << "******************************" << std::endl;
34                std::cout << "DevicePkg: " << std::endl;
35                std::cout << "<devicepkg id=" << parse.getDevPkgID() << " version=" << parse.getDevPkgVersion() << " name=" << parse.getDevPkgName() << ">" << std::endl;
36                std::cout << "  <title>" << parse.getDevPkgTitle() << "</title>" << std::endl;
37                std::cout << "  <author>" << parse.getDevPkgAuthor() << "</author>" << std::endl;
38                std::cout << "  <description>" << parse.getDevPkgDescription() << "</description>" << std::endl;
39                std::cout << "          <hwdeviceregistration id=" << parse.getHWDevRegID() << " version=" << parse.getHWDevRegVersion();
40                        std::cout << " name=" << parse.getHWDevRegName() << ">" << std::endl;
41                std::cout << "                  <propertyfile type=" << parse.getPropFileType() << ">" << std::endl;
42                std::cout << "                          <localfile name=" << parse.getPropFileLocalFile() << "/>" << std::endl;
43                std::cout << "                  </propertyfile>" << std::endl;
44                std::cout << "                  <description>" << parse.getHWDevRegDescription() << "</description>" << std::endl;
45                std::cout << "                  <manufacturer>" << parse.getHWDevRegManufacturer() << "</manufacturer>" << std::endl;
46                std::cout << "                  <modelnumber>" << parse.getHWDevRegModelNumber() << "</modelnumber>" << std::endl;
47                std::cout << "                  <deviceclass>" << std::endl;
48                for (int i = 0; i < parse.getDeviceClass().size(); i++)
49                {
50                std::cout << "                          <class>" << parse.getDeviceClass()[i] << "</class>" << std::endl;
51                }
52                std::cout << "                  </deviceclass>" << std::endl;
53
54                for (int i = 0; i < parse.getChildHWDevice().size(); i++)
55                {
56                std::cout << "                  <childhwdevice>" << std::endl;
57//              std::cout << "                          <hwdeviceregistration id=" << parse.getChildHWDevice()[i]->getHWDeviceRegistration().getHWDevRegID() << std::endl;
58                }
59
60
61
62
63                std::cout << "</devicepkg>" << std::endl;
64        }
65        else
66        {
67                std::cout << "can't load file: " << root << std::endl;
68        }
69
70
71}
72
73
74
75
76
Note: See TracBrowser for help on using the browser.