00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c: 00002 /* 00003 * Copyright (C) 2005 Dell Inc. 00004 * by Michael Brown <Michael_E_Brown@dell.com> 00005 * Licensed under the Open Software License version 2.1 00006 * 00007 * Alternatively, you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published 00009 * by the Free Software Foundation; either version 2 of the License, 00010 * or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 * See the GNU General Public License for more details. 00016 */ 00017 00018 00019 #ifndef _TESTSMBIOSXML_H 00020 #define _TESTSMBIOSXML_H 00021 00022 #include "smbios/compat.h" 00023 00024 #include <cppunit/extensions/HelperMacros.h> 00025 #include <typeinfo> 00026 #include <string> 00027 00028 #include "smbios/ISmbiosXml.h" 00029 #include "smbios/ICmosRW.h" 00030 #include "smbios/IToken.h" 00031 #include "smbios/SystemInfo.h" 00032 00033 #include "../libraries/common/XmlUtils.h" 00034 00035 #include "outputctl.h" 00036 00037 extern std::string global_testName; 00038 extern std::string global_testDirectory; 00039 00040 class testSmbiosXml : public CppUnit::TestFixture 00041 { 00042 protected: 00043 virtual std::string getTestName() 00044 { 00045 //return TEST_DIR; 00046 return global_testName; 00047 } 00048 virtual std::string getTestDirectory() 00049 { 00050 //return DEFAULT_TEST_DIR; 00051 return global_testDirectory; 00052 }; 00053 virtual std::string getXmlFile() 00054 { 00055 return "/../doc/smbios23.xml"; 00056 }; 00057 00058 std::string getTestInputString( std::string toFind ); 00059 00060 void checkSkipTest( std::string testName); 00061 00062 // parser owns all XML entities. When it is deleted, everything 00063 // goes with it. 00064 XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *parser; 00065 00066 // The doc is owned by the parser. We do not have to clean it up 00067 // it is deleted when the parser is released. We keep a ref 00068 // here for speed purposes 00069 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc; 00070 00071 public: 00072 virtual void setUp(); 00073 virtual void tearDown(); 00074 virtual void resetFactoryToBuiltinXml(); 00075 00076 // table tests 00077 void testTable_Subscript(); 00078 void testTable_Subscript_builtinXml(); 00079 void testEntryCount (); 00080 void testEntryCount_builtinXml (); 00081 void testConstIterator (); 00082 void testConstIterator_builtinXml (); 00083 void testSubscriptOperator1 (); 00084 void testSubscriptOperator1_builtinXml (); 00085 void testSubscriptOperator2 (); 00086 void testSubscriptOperator2_builtinXml (); 00087 void testSubscriptOperator3 (); 00088 void testSubscriptOperator3_builtinXml (); 00089 00090 // item tests 00091 void testStreamify(); 00092 void testEachItemAccessors(); 00093 void testEachItemAccessors_builtinXml(); 00094 void testItem_GetBiosInfo(); 00095 void testItem_GetBiosInfo_builtinXml(); 00096 void testItem_GetSystemInfo(); 00097 void testItem_GetSystemInfo_builtinXml(); 00098 void testTypeMismatch(); 00099 void testTypeMismatch_builtinXml(); 00100 void testItemIdentity(); 00101 void testItemIdentity_builtinXml(); 00102 void testGetBoundaries(); 00103 void testGetBoundaries_builtinXml(); 00104 00105 // cmos token tests 00106 void testCmosConstructor(); 00107 void testCmosChecksum(); 00108 void testCmosWriting(); 00109 00110 // smi tests 00111 void testSmi_callingInterface(); 00112 void testSmi_callingInterface_physaddr(); 00113 00114 // systeminfo tests 00115 void testSystemInfo(); 00116 void testSystemInfo_builtinXml(); 00117 00118 // testInput.xml tests 00119 void testIdByte(); 00120 void testServiceTag(); 00121 void testServiceTagWriting(); 00122 void testAssetTag(); 00123 void testSystemName(); 00124 void testLibraryVersion(); 00125 void testBiosVersion(); 00126 void testIsDell(); 00127 void testVariousAccessors(); 00128 void testOutOfBounds(); 00129 void testConstructionOffset(); 00130 00131 // other 00132 void testStateBytes(); 00133 void testUpBoot(); 00134 00135 // Exception Tests 00136 void testException(); 00137 00138 // make sure to put this at the end... 00139 CPPUNIT_TEST_SUITE (testSmbiosXml); 00140 00141 CPPUNIT_TEST (testTable_Subscript); 00142 CPPUNIT_TEST (testTable_Subscript_builtinXml); 00143 CPPUNIT_TEST (testEntryCount); 00144 CPPUNIT_TEST (testEntryCount_builtinXml); 00145 CPPUNIT_TEST (testConstIterator); 00146 CPPUNIT_TEST (testConstIterator_builtinXml); 00147 CPPUNIT_TEST (testSubscriptOperator1); 00148 CPPUNIT_TEST (testSubscriptOperator1_builtinXml); 00149 CPPUNIT_TEST (testSubscriptOperator2); 00150 CPPUNIT_TEST (testSubscriptOperator2_builtinXml); 00151 CPPUNIT_TEST (testSubscriptOperator3); 00152 CPPUNIT_TEST (testSubscriptOperator3_builtinXml); 00153 00154 CPPUNIT_TEST (testStreamify); 00155 CPPUNIT_TEST (testItemIdentity); 00156 CPPUNIT_TEST (testItemIdentity_builtinXml); 00157 CPPUNIT_TEST (testEachItemAccessors); 00158 CPPUNIT_TEST (testEachItemAccessors_builtinXml); 00159 CPPUNIT_TEST (testItem_GetBiosInfo); 00160 CPPUNIT_TEST (testItem_GetBiosInfo_builtinXml); 00161 CPPUNIT_TEST (testItem_GetSystemInfo); 00162 CPPUNIT_TEST (testItem_GetSystemInfo_builtinXml); 00163 CPPUNIT_TEST (testTypeMismatch); 00164 CPPUNIT_TEST (testTypeMismatch_builtinXml); 00165 CPPUNIT_TEST (testGetBoundaries); 00166 CPPUNIT_TEST (testGetBoundaries_builtinXml); 00167 00168 CPPUNIT_TEST (testCmosConstructor); 00169 CPPUNIT_TEST (testCmosChecksum); 00170 CPPUNIT_TEST (testCmosWriting); 00171 00172 CPPUNIT_TEST (testSmi_callingInterface); 00173 CPPUNIT_TEST (testSmi_callingInterface_physaddr); 00174 00175 CPPUNIT_TEST (testSystemInfo); 00176 CPPUNIT_TEST (testSystemInfo_builtinXml); 00177 00178 CPPUNIT_TEST (testIdByte); 00179 CPPUNIT_TEST (testServiceTag); 00180 CPPUNIT_TEST (testServiceTagWriting); 00181 CPPUNIT_TEST (testAssetTag); 00182 CPPUNIT_TEST (testSystemName); 00183 00184 00185 00186 CPPUNIT_TEST (testLibraryVersion); 00187 CPPUNIT_TEST (testBiosVersion); 00188 CPPUNIT_TEST (testIsDell); 00189 CPPUNIT_TEST (testVariousAccessors); 00190 CPPUNIT_TEST (testOutOfBounds); 00191 CPPUNIT_TEST (testConstructionOffset); 00192 00193 CPPUNIT_TEST (testStateBytes); 00194 CPPUNIT_TEST (testUpBoot); 00195 00196 CPPUNIT_TEST (testException); 00197 00198 CPPUNIT_TEST_SUITE_END (); 00199 }; 00200 00201 #endif