SMBIOS Library
testPlatform.h
Go to the documentation of this file.
1 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
2 /*
3  * Copyright (C) 2005 Dell Inc.
4  * by Michael Brown <Michael_E_Brown@dell.com>
5  * Licensed under the Open Software License version 2.1
6  *
7  * Alternatively, you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; either version 2 of the License,
10  * or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU General Public License for more details.
16  */
17 
18 
19 #ifndef _TESTPLATFORM_H
20 #define _TESTPLATFORM_H
21 
22 #include "smbios/compat.h"
23 
24 #include <cppunit/extensions/HelperMacros.h>
25 #include <typeinfo>
26 #include <string>
27 
28 #include "smbios/ISmbios.h"
29 #include "smbios/ICmosRW.h"
30 #include "smbios/IToken.h"
31 #include "smbios/SystemInfo.h"
32 
33 #include "XmlUtils.h"
34 
35 #include "outputctl.h"
36 
37 extern int global_argc;
38 extern char ** global_argv;
39 
40 class testPlatform : public CppUnit::TestFixture
41 {
42 protected:
43  virtual std::string getCppunitTopDirectory()
44  {
45  //return TEST_DIR;
46  return global_argv[1];
47  }
48  virtual std::string getWritableDirectory()
49  {
50  //return DEFAULT_TEST_DIR;
51  return global_argv[2];
52  };
53 
54  virtual std::string getTestName()
55  {
56  //return TEST_DIR;
57  return global_argv[3];
58  }
59  virtual std::string getTestDirectory()
60  {
61  //return DEFAULT_TEST_DIR;
62  return global_argv[4];
63  };
64 
65  std::string getTestInputString( std::string toFind, std::string section="systemInfo" );
66 
67  void checkSkipTest( std::string testName);
68 
69  // parser owns all XML entities. When it is deleted, everything
70  // goes with it.
72 
73  // The doc is owned by the parser. We do not have to clean it up
74  // it is deleted when the parser is released. We keep a ref
75  // here for speed purposes
77 
78 public:
79  virtual void setUp();
80  virtual void tearDown();
81 
82  // item tests
83  void testGetBoundaries();
84 
85  // cmos token tests
86  void testCmosChecksum();
87  void testCmosWriting();
88 
89  // systeminfo tests
90  void testSystemInfo();
91 
92  // testInput.xml tests
93  void testIdByte();
94  void testServiceTag();
95  void testServiceTagWriting();
96  void testAssetTag();
97  void testSystemName();
98  void testBiosVersion();
99  void testIsDell();
100  void testVariousAccessors();
101  void testOutOfBounds();
104 
105  // other
106  void testStateBytes();
107  void testUpBoot();
108 
109  // make sure to put this at the end...
111 
114 
116 
122 
123 
124 
131 
134 
136 };
137 
138 #endif