SMBIOS Library
testRbu.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 _TESTRBU_H
20 #define _TESTRBU_H
21 
22 #include "smbios/compat.h"
23 
24 #include <cppunit/extensions/HelperMacros.h>
25 #include <string>
26 
27 #include "smbios/DellRbu.h"
28 #include "XmlUtils.h"
29 
30 #include "outputctl.h"
31 
32 extern int global_argc;
33 extern char ** global_argv;
34 
35 class testRbu : public CppUnit::TestFixture
36 {
37 protected:
38  virtual std::string getCppunitTopDirectory()
39  {
40  //return TEST_DIR;
41  return global_argv[1];
42  }
43  virtual std::string getWritableDirectory()
44  {
45  //return DEFAULT_TEST_DIR;
46  return global_argv[2];
47  };
48  virtual std::string getTestName()
49  {
50  //return TEST_DIR;
51  return global_argv[3];
52  }
53  virtual std::string getTestDirectory()
54  {
55  //return DEFAULT_TEST_DIR;
56  return global_argv[4];
57  };
58 
59  std::string getTestInputString( std::string toFind, std::string section="systemInfo" );
60 
61  // parser owns all XML entities. When it is deleted, everything
62  // goes with it.
64 
65  // The doc is owned by the parser. We do not have to clean it up
66  // it is deleted when the parser is released. We keep a ref
67  // here for speed purposes
69 
70 
71 public:
72  virtual void setUp();
73  virtual void tearDown();
74 
75  // helper functions
76  std::auto_ptr<rbu::IRbuHdr> checkHdrInfo(std::string name);
77 
78  // table tests
79  void testRbuBasic();
80  void testRbuBadData();
81  void testRbuOldVerCompare();
82  void testRbuNewVerCompare();
83  void testRbuNewVerSplit();
84  void testRbuOutput();
85 
86  // make sure to put this at the end...
88 
95 
97 };
98 
99 #endif