Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

testPlatform.h

Go to the documentation of this file.
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 _TESTPLATFORM_H
00020 #define _TESTPLATFORM_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 testPlatform  : 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     virtual std::string getTestName()
00055     {
00056         //return TEST_DIR;
00057         return global_argv[3];
00058     }
00059     virtual std::string getTestDirectory()
00060     {
00061         //return DEFAULT_TEST_DIR;
00062         return global_argv[4];
00063     };
00064     virtual std::string getXmlFile()
00065     {
00066         return "/../doc/smbios23.xml";
00067     };
00068 
00069     std::string getTestInputString( std::string toFind, std::string section="systemInfo" );
00070 
00071     void checkSkipTest( std::string testName);
00072 
00073     // parser owns all XML entities. When it is deleted, everything
00074     // goes with it.
00075     XML_NAMESPACE DOMBuilder *parser;
00076 
00077     // The doc is owned by the parser. We do not have to clean it up
00078     // it is deleted when the parser is released. We keep a ref
00079     // here for speed purposes
00080     XML_NAMESPACE DOMDocument *doc;
00081 
00082 public:
00083     virtual void setUp();
00084     virtual void tearDown();
00085     virtual void resetFactoryToBuiltinXml();
00086 
00087     // item tests
00088     void testGetBoundaries();
00089     void testGetBoundaries_builtinXml();
00090 
00091     // cmos token tests
00092     void testCmosChecksum();
00093     void testCmosWriting();
00094 
00095     // systeminfo tests
00096     void testSystemInfo();
00097     void testSystemInfo_builtinXml();
00098 
00099     // testInput.xml tests
00100     void testIdByte();
00101     void testServiceTag();
00102     void testServiceTagWriting();
00103     void testAssetTag();
00104     void testSystemName();
00105     void testBiosVersion();
00106     void testIsDell();
00107     void  testVariousAccessors();
00108     void  testOutOfBounds();
00109     void  testConstructionOffset1();
00110     void  testConstructionOffset2();
00111 
00112     // other
00113     void testStateBytes();
00114     void testUpBoot();
00115 
00116     // make sure to put this at the end...
00117     CPPUNIT_TEST_SUITE (testPlatform);
00118 
00119     CPPUNIT_TEST (testCmosChecksum);
00120     CPPUNIT_TEST (testCmosWriting);
00121 
00122     CPPUNIT_TEST (testSystemInfo);
00123     CPPUNIT_TEST (testSystemInfo_builtinXml);
00124 
00125     CPPUNIT_TEST (testIdByte);
00126     CPPUNIT_TEST (testServiceTag);
00127     CPPUNIT_TEST (testServiceTagWriting);
00128     CPPUNIT_TEST (testAssetTag);
00129     CPPUNIT_TEST (testSystemName);
00130 
00131 
00132 
00133     CPPUNIT_TEST (testBiosVersion);
00134     CPPUNIT_TEST (testIsDell);
00135     CPPUNIT_TEST (testVariousAccessors);
00136     CPPUNIT_TEST (testOutOfBounds);
00137     CPPUNIT_TEST (testConstructionOffset1);
00138     CPPUNIT_TEST (testConstructionOffset2);
00139 
00140     CPPUNIT_TEST (testStateBytes);
00141     CPPUNIT_TEST (testUpBoot);
00142 
00143     CPPUNIT_TEST_SUITE_END ();
00144 };
00145 
00146 #endif

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5