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 _TESTSTANDALONE_H 00020 #define _TESTSTANDALONE_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 "XmlUtils.h" 00034 00035 #include "outputctl.h" 00036 00037 extern int global_argc; 00038 extern char ** global_argv; 00039 00040 class testStandalone : public CppUnit::TestFixture 00041 { 00042 protected: 00043 virtual std::string getCppunitTopDirectory() 00044 { 00045 //return TEST_DIR; 00046 return global_argv[1]; 00047 } 00048 virtual std::string getWritableDirectory() 00049 { 00050 //return DEFAULT_TEST_DIR; 00051 return global_argv[2]; 00052 }; 00053 00054 00055 virtual std::string getTestName() 00056 { 00057 //return TEST_DIR; 00058 return global_argv[3]; 00059 } 00060 virtual std::string getTestDirectory() 00061 { 00062 //return DEFAULT_TEST_DIR; 00063 return global_argv[4]; 00064 }; 00065 virtual std::string getXmlFile() 00066 { 00067 return "/../doc/smbios23.xml"; 00068 }; 00069 00070 public: 00071 virtual void setUp(); 00072 virtual void tearDown(); 00073 virtual void resetFactoryToBuiltinXml(); 00074 00075 // table tests 00076 void testTable_Subscript(); 00077 void testTable_Subscript_builtinXml(); 00078 void testEntryCount (); 00079 void testEntryCount_builtinXml (); 00080 void testConstIterator (); 00081 void testConstIterator_builtinXml (); 00082 void testSubscriptOperator1 (); 00083 void testSubscriptOperator1_builtinXml (); 00084 void testSubscriptOperator2 (); 00085 void testSubscriptOperator2_builtinXml (); 00086 void testSubscriptOperator3 (); 00087 void testSubscriptOperator3_builtinXml (); 00088 void testSmbiosXml(); 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 // memory tests 00106 void testMemoryBadFiles(); 00107 void testMemoryFuncs(); 00108 00109 // cmos token tests 00110 void testCmosConstructor(); 00111 00112 // smi tests 00113 void testSmi_callingInterface(); 00114 void testSmi_callingInterface_physaddr(); 00115 00116 // testInput.xml tests 00117 void testServiceTagWriting(); 00118 void testLibraryVersion(); 00119 00120 // other 00121 void testStateBytes(); 00122 00123 // Exception Tests 00124 void testException(); 00125 00126 // Exception Tests 00127 void testNonXml(); 00128 00129 // make sure to put this at the end... 00130 CPPUNIT_TEST_SUITE (testStandalone); 00131 00132 CPPUNIT_TEST (testTable_Subscript); 00133 CPPUNIT_TEST (testTable_Subscript_builtinXml); 00134 CPPUNIT_TEST (testEntryCount); 00135 CPPUNIT_TEST (testEntryCount_builtinXml); 00136 CPPUNIT_TEST (testConstIterator); 00137 CPPUNIT_TEST (testConstIterator_builtinXml); 00138 CPPUNIT_TEST (testSubscriptOperator1); 00139 CPPUNIT_TEST (testSubscriptOperator1_builtinXml); 00140 CPPUNIT_TEST (testSubscriptOperator2); 00141 CPPUNIT_TEST (testSubscriptOperator2_builtinXml); 00142 CPPUNIT_TEST (testSubscriptOperator3); 00143 CPPUNIT_TEST (testSubscriptOperator3_builtinXml); 00144 CPPUNIT_TEST (testSmbiosXml); 00145 00146 CPPUNIT_TEST (testStreamify); 00147 CPPUNIT_TEST (testItemIdentity); 00148 CPPUNIT_TEST (testItemIdentity_builtinXml); 00149 CPPUNIT_TEST (testEachItemAccessors); 00150 CPPUNIT_TEST (testEachItemAccessors_builtinXml); 00151 CPPUNIT_TEST (testItem_GetBiosInfo); 00152 CPPUNIT_TEST (testItem_GetBiosInfo_builtinXml); 00153 CPPUNIT_TEST (testItem_GetSystemInfo); 00154 CPPUNIT_TEST (testItem_GetSystemInfo_builtinXml); 00155 CPPUNIT_TEST (testGetBoundaries); 00156 CPPUNIT_TEST (testGetBoundaries_builtinXml); 00157 00158 00159 CPPUNIT_TEST (testTypeMismatch); 00160 CPPUNIT_TEST (testTypeMismatch_builtinXml); 00161 00162 CPPUNIT_TEST (testMemoryBadFiles); 00163 CPPUNIT_TEST (testMemoryFuncs); 00164 00165 CPPUNIT_TEST (testCmosConstructor); 00166 00167 CPPUNIT_TEST (testSmi_callingInterface); 00168 CPPUNIT_TEST (testSmi_callingInterface_physaddr); 00169 00170 CPPUNIT_TEST (testLibraryVersion); 00171 CPPUNIT_TEST (testException); 00172 00173 CPPUNIT_TEST (testNonXml); 00174 00175 CPPUNIT_TEST_SUITE_END (); 00176 }; 00177 00178 #endif