Show
Ignore:
Timestamp:
02/16/09 17:55:56 (4 years ago)
Author:
mcarrick
Message:

reducing number of test cases and test code complexity

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/mcarrick/DPD/testApp.cpp

    r8703 r8704  
    1 #include "DevicePkgRef.h" 
    2 #include "HWDeviceRegistration.h" 
    31#include "DevicePkg.h" 
    42 
    53#include <iostream> 
    64 
    7 // test functions 
    8 void testLocalFile(); 
    9 void testDeviceClass(); 
    10 void testDevicePkgRef(); 
    11 void testPropertyFile(); 
    12 void testHWDeviceRegistration(); 
     5// test function 
    136void testDevicePkg(); 
    14  
    157 
    168int main() 
     
    1911        std::cout << "running test app..." << std::endl; 
    2012 
    21         //testDeviceClass(); 
    22         //testDevicePkgRef(); 
    23         //testPropertyFile(); 
    24         //testHWDeviceRegistration(); 
    2513        testDevicePkg(); 
    2614 
     
    8371} 
    8472 
    85 void testPropertyFile() 
    86 { 
    87         std::cout << "testPropertyFile()" << std::endl; 
    88  
    89         char *root = "xml/propertyFile.xml"; 
    90         TiXmlDocument xmlDoc(root); // set up path to XML through char string 
    91  
    92         if (xmlDoc.LoadFile()) 
    93         { 
    94                 TiXmlHandle doc(&xmlDoc); // get handle to XML file 
    95                 TiXmlElement *propFile = doc.FirstChild("propertyfile").Element(); 
    96  
    97                 PropertyFile parse(propFile); 
    98         } 
    99         else 
    100         { 
    101                 std::cout << "can't load the file " << root << std::endl; 
    102         } 
    103         std::cout << std::endl; 
    104 } 
    105  
    106  
    107 void testHWDeviceRegistration() 
    108 { 
    109         std::cout << "testHWDeviceRegistration()" << std::endl; 
    110  
    111         char *root = "xml/hwDeviceRegistration.xml"; 
    112         TiXmlDocument xmlDoc(root); // set up path to XML through char string 
    113  
    114         if (xmlDoc.LoadFile()) 
    115         { 
    116                 TiXmlHandle doc(&xmlDoc); // get handle to XML file 
    117                 TiXmlElement *devReg = doc.FirstChild("hwdeviceregistration").Element(); 
    118  
    119                 HWDeviceRegistration parse(devReg); 
    120  
    121                 std::cout << std::endl << std::endl; 
    122  
    123         } 
    124         else 
    125         { 
    126                 std::cout << "you botched it, can't load " << root << std::endl; 
    127         } 
    128         std::cout << std::endl; 
    129 } 
    130  
    131 void testDevicePkgRef() 
    132 { 
    133         std::cout << "testDevicePkgRef()" << std::endl; 
    134  
    135         char *root = "xml/devicePkgRef.xml"; 
    136         TiXmlDocument xmlDoc(root); // set up path to XML through char string 
    137  
    138         if (xmlDoc.LoadFile()) 
    139         { 
    140                 TiXmlHandle doc(&xmlDoc); // get handle to XML file 
    141                 TiXmlElement *devPkgRef = doc.FirstChild("devicepkgref").Element(); 
    142  
    143                 DevicePkgRef parse(devPkgRef); 
    144         } 
    145         else 
    146         { 
    147                 std::cout << "you botched it, couldn't load " << root << std::endl; 
    148         } 
    149         std::cout << std::endl; 
    150 } 
    151  
    152 void testDeviceClass() 
    153 { 
    154         std::cout << "testDeviceClass()" << std::endl; 
    155         char *root = "xml/deviceClass.xml"; 
    156         TiXmlDocument xmlDoc(root); // set up path to XML through character string 
    157  
    158         if (xmlDoc.LoadFile()) 
    159         { 
    160                 TiXmlHandle doc(&xmlDoc); // get handle to XML file 
    161                 TiXmlElement *devClass = doc.FirstChild("deviceclass").Element(); 
    162                 DeviceClass parse(devClass); 
    163  
    164                 std::cout << "*************************" << std::endl; 
    165                 std::cout << "DeviceClass: " << std::endl; 
    166                 std::cout << "Classes: " << std::endl; 
    167  
    168                         int size = parse.getDeviceClass().size(); 
    169                         for (int i = 0; i < size; i++) 
    170                         { 
    171                                 std::cout << parse.getDeviceClass()[i] << ", "; 
    172                         } 
    173  
    174                 std::cout << std::endl; 
    175                 std::cout << "*************************" << std::endl; 
    176         } 
    177         else 
    178         { 
    179                 std::cout << "you botched it, couldn't load " << root << std::endl; 
    180         } 
    181         std::cout << std::endl; 
    182 } 
    18373 
    18474